-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathpaths.php
More file actions
144 lines (125 loc) · 4.03 KB
/
paths.php
File metadata and controls
144 lines (125 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
defined('DS') or exit('No direct access.');
/*
|----------------------------------------------------------------
| Application Environments
|----------------------------------------------------------------
|
| Rakit uses a simple approach to environment.
| Just define which URL belongs to which environment, when the
| application is accessed from a URL that matches the pattern,
| the content of the environment config file will be overwritten.
|
*/
$environments = [
'local' => ['http://localhost*', 'http://127.0.0.1*', '*.test'],
// Add another environment here if needed..
];
// --------------------------------------------------------------
// Path to default package directory.
// --------------------------------------------------------------
$paths = ['app' => 'application'];
// --------------------------------------------------------------
// Path to the application key file.
// --------------------------------------------------------------
$paths['rakit_key'] = 'key.php';
// --------------------------------------------------------------
// Path to the system directory.
// --------------------------------------------------------------
$paths['system'] = 'system';
// --------------------------------------------------------------
// Path to the packages directory.
// --------------------------------------------------------------
$paths['package'] = 'packages';
// --------------------------------------------------------------
// Path to the storage directory.
// --------------------------------------------------------------
$paths['storage'] = 'storage';
// --------------------------------------------------------------
// Path to the assets directory.
// --------------------------------------------------------------
$paths['assets'] = 'assets';
// --------------------------------------------------------------
// Change working directory to root directory.
// --------------------------------------------------------------
chdir(__DIR__);
// --------------------------------------------------------------
// Define path to base directory.
// --------------------------------------------------------------
$GLOBALS['rakit_paths']['base'] = __DIR__ . DS;
// --------------------------------------------------------------
// Define path to system directory.
// --------------------------------------------------------------
foreach ($paths as $name => $path) {
if (!isset($GLOBALS['rakit_paths'][$name])) {
$GLOBALS['rakit_paths'][$name] = ('rakit_key' === $name)
? $GLOBALS['rakit_paths']['base'] . $path
: realpath($path) . DS;
}
}
/**
* Global function for accessing path.
*
* <code>
*
* $storage = path('storage');
*
* </code>
*
* @param string $path
*
* @return string
*/
function path($path)
{
return $GLOBALS['rakit_paths'][$path];
}
/**
* Global function for setting path.
*
* @param string $path
* @param string $value
*/
function set_path($path, $value)
{
$GLOBALS['rakit_paths'][$path] = $value;
}
// --------------------------------------------------------------
// Polyfill for newer PHP versions.
// --------------------------------------------------------------
if (PHP_VERSION_ID < 70000) {
interface Throwable
{
public function getMessage();
public function getCode();
public function getFile();
public function getLine();
public function getTrace();
public function getTraceAsString();
public function getPrevious();
public function __toString();
}
}
if (PHP_VERSION_ID < 80000) {
final class Attribute
{
const TARGET_CLASS = 1;
const TARGET_FUNCTION = 2;
const TARGET_METHOD = 4;
const TARGET_PROPERTY = 8;
const TARGET_CLASS_CONSTANT = 16;
const TARGET_PARAMETER = 32;
const TARGET_ALL = 63;
const IS_REPEATABLE = 64;
}
}
if (PHP_VERSION_ID < 80100) {
#[Attribute(Attribute::TARGET_METHOD)]
final class ReturnTypeWillChange
{
public function __construct()
{
// ..
}
}
}