1 | <?php |
||
7 | class Server |
||
8 | { |
||
9 | /** @var Navigator */ |
||
10 | public static $n; |
||
11 | |||
12 | /** @var float */ |
||
13 | public static $start; |
||
14 | |||
15 | /** @var array */ |
||
16 | public static $env = array(); |
||
17 | |||
18 | /** |
||
19 | * Kick off the server with a set of modules. |
||
20 | * |
||
21 | * The first module is automatically the root module. |
||
22 | * |
||
23 | * @param string $path filepath to deployment directory |
||
24 | * @param string[] $modules array of class names of modules to include |
||
25 | * |
||
26 | * @return void |
||
27 | */ |
||
28 | public static function bootstrap($path = null, $modules = array()) |
||
42 | |||
43 | /** |
||
44 | * Detect some basic information about our deployment |
||
45 | * |
||
46 | * @return void |
||
47 | */ |
||
48 | private static function detectEnv() |
||
53 | |||
54 | /** |
||
55 | * Init Server from Cache |
||
56 | * |
||
57 | * @param $modules |
||
58 | * @param $cache |
||
59 | * |
||
60 | * @return void |
||
61 | */ |
||
62 | private static function initCached($modules, $cache) |
||
72 | |||
73 | /** |
||
74 | * Set timestamp and Navigator instance |
||
75 | * |
||
76 | * @return void |
||
77 | */ |
||
78 | private static function start() |
||
89 | |||
90 | /** |
||
91 | * @param string $cache |
||
92 | * |
||
93 | * @return bool |
||
94 | */ |
||
95 | private static function loadCache($cache) |
||
103 | |||
104 | /** |
||
105 | * Add one or more modules to the Saltwater\Navigator module stack |
||
106 | * |
||
107 | * Proxy for Saltwater\Navigator::addModule() |
||
108 | * |
||
109 | * @param string[] $array |
||
110 | * |
||
111 | * @return bool|null |
||
112 | */ |
||
113 | private static function addModules($array) |
||
127 | |||
128 | /** |
||
129 | * Add a module to the Saltwater\Navigator module stack |
||
130 | * |
||
131 | * Proxy for Saltwater\Navigator::addModule() |
||
132 | * |
||
133 | * @param string $class |
||
134 | * @param bool $master |
||
135 | * |
||
136 | * @return bool|null |
||
137 | */ |
||
138 | public static function addModule($class, $master = true) |
||
142 | |||
143 | /** |
||
144 | * Halt the server and send a html header response |
||
145 | * |
||
146 | * @param int $code |
||
147 | * @param string $message |
||
148 | * |
||
149 | * @return void |
||
150 | */ |
||
151 | public static function halt($code, $message) |
||
155 | |||
156 | /** |
||
157 | * Forget everything |
||
158 | * |
||
159 | * @return void |
||
160 | */ |
||
161 | public static function destroy() |
||
167 | } |
||
168 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.