@@ -5,44 +5,44 @@ |
||
5 | 5 | class Process |
6 | 6 | { |
7 | 7 | |
8 | - protected $_pid; |
|
9 | - protected $_command; |
|
10 | - |
|
11 | - public function __construct($command = false) |
|
12 | - { |
|
13 | - if ($command) { |
|
14 | - $this->_command = $command; |
|
15 | - } |
|
16 | - } |
|
17 | - |
|
18 | - public function run() |
|
19 | - { |
|
20 | - $command = "nohup $this->_command > /dev/null 2>&1 & echo $!"; |
|
21 | - $this->_pid = shell_exec($command); |
|
22 | - |
|
23 | - return $this; |
|
24 | - } |
|
25 | - |
|
26 | - public function running() |
|
27 | - { |
|
28 | - exec("ps -p $this->_pid", $output); |
|
29 | - return isset($output[1]); |
|
30 | - } |
|
31 | - |
|
32 | - public function stop() |
|
33 | - { |
|
34 | - exec("kill $this->_pid"); |
|
35 | - return !$this->running(); |
|
36 | - } |
|
37 | - |
|
38 | - public function setPID($pid) |
|
39 | - { |
|
40 | - $this->_pid = $pid; |
|
41 | - } |
|
42 | - |
|
43 | - public function getPID() |
|
44 | - { |
|
45 | - return $this->_pid; |
|
46 | - } |
|
8 | + protected $_pid; |
|
9 | + protected $_command; |
|
10 | + |
|
11 | + public function __construct($command = false) |
|
12 | + { |
|
13 | + if ($command) { |
|
14 | + $this->_command = $command; |
|
15 | + } |
|
16 | + } |
|
17 | + |
|
18 | + public function run() |
|
19 | + { |
|
20 | + $command = "nohup $this->_command > /dev/null 2>&1 & echo $!"; |
|
21 | + $this->_pid = shell_exec($command); |
|
22 | + |
|
23 | + return $this; |
|
24 | + } |
|
25 | + |
|
26 | + public function running() |
|
27 | + { |
|
28 | + exec("ps -p $this->_pid", $output); |
|
29 | + return isset($output[1]); |
|
30 | + } |
|
31 | + |
|
32 | + public function stop() |
|
33 | + { |
|
34 | + exec("kill $this->_pid"); |
|
35 | + return !$this->running(); |
|
36 | + } |
|
37 | + |
|
38 | + public function setPID($pid) |
|
39 | + { |
|
40 | + $this->_pid = $pid; |
|
41 | + } |
|
42 | + |
|
43 | + public function getPID() |
|
44 | + { |
|
45 | + return $this->_pid; |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -3,24 +3,24 @@ |
||
3 | 3 | class Nip_Hash |
4 | 4 | { |
5 | 5 | |
6 | - protected static $golden_primes = array( |
|
7 | - 36 => array(1, 23, 809, 28837, 1038073, 37370257, 1345328833) |
|
8 | - ); |
|
6 | + protected static $golden_primes = array( |
|
7 | + 36 => array(1, 23, 809, 28837, 1038073, 37370257, 1345328833) |
|
8 | + ); |
|
9 | 9 | |
10 | - public static function uhash($num, $len = 5, $base = 36) |
|
11 | - { |
|
12 | - $gp = self::$golden_primes[$base]; |
|
13 | - $maxlen = count($gp); |
|
14 | - $len = $len > ($maxlen - 1) ? ($maxlen - 1) : $len; |
|
15 | - while ($len < $maxlen && pow($base, $len) < $num) |
|
16 | - $len++; |
|
17 | - if ($len >= $maxlen) |
|
18 | - throw new Exception($num . " out of range (max " . pow($base, $maxlen - 1) . ")"); |
|
19 | - $ceil = pow($base, $len); |
|
20 | - $prime = $gp[$len]; |
|
21 | - $dechash = ($num * $prime) % $ceil; |
|
22 | - $hash = base_convert($dechash, 10, $base); |
|
23 | - return str_pad($hash, $len, "0", STR_PAD_LEFT); |
|
24 | - } |
|
10 | + public static function uhash($num, $len = 5, $base = 36) |
|
11 | + { |
|
12 | + $gp = self::$golden_primes[$base]; |
|
13 | + $maxlen = count($gp); |
|
14 | + $len = $len > ($maxlen - 1) ? ($maxlen - 1) : $len; |
|
15 | + while ($len < $maxlen && pow($base, $len) < $num) |
|
16 | + $len++; |
|
17 | + if ($len >= $maxlen) |
|
18 | + throw new Exception($num . " out of range (max " . pow($base, $maxlen - 1) . ")"); |
|
19 | + $ceil = pow($base, $len); |
|
20 | + $prime = $gp[$len]; |
|
21 | + $dechash = ($num * $prime) % $ceil; |
|
22 | + $hash = base_convert($dechash, 10, $base); |
|
23 | + return str_pad($hash, $len, "0", STR_PAD_LEFT); |
|
24 | + } |
|
25 | 25 | |
26 | 26 | } |
@@ -12,10 +12,12 @@ |
||
12 | 12 | $gp = self::$golden_primes[$base]; |
13 | 13 | $maxlen = count($gp); |
14 | 14 | $len = $len > ($maxlen - 1) ? ($maxlen - 1) : $len; |
15 | - while ($len < $maxlen && pow($base, $len) < $num) |
|
16 | - $len++; |
|
17 | - if ($len >= $maxlen) |
|
18 | - throw new Exception($num . " out of range (max " . pow($base, $maxlen - 1) . ")"); |
|
15 | + while ($len < $maxlen && pow($base, $len) < $num) { |
|
16 | + $len++; |
|
17 | + } |
|
18 | + if ($len >= $maxlen) { |
|
19 | + throw new Exception($num . " out of range (max " . pow($base, $maxlen - 1) . ")"); |
|
20 | + } |
|
19 | 21 | $ceil = pow($base, $len); |
20 | 22 | $prime = $gp[$len]; |
21 | 23 | $dechash = ($num * $prime) % $ceil; |
@@ -37,9 +37,9 @@ |
||
37 | 37 | $this->userAgent = $_SERVER['HTTP_USER_AGENT']; |
38 | 38 | $this->accept = $_SERVER['HTTP_ACCEPT']; |
39 | 39 | |
40 | - if (isset($_SERVER['HTTP_X_WAP_PROFILE'])|| isset($_SERVER['HTTP_PROFILE'])) { |
|
40 | + if (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])) { |
|
41 | 41 | $this->isMobile = true; |
42 | - } elseif (strpos($this->accept,'text/vnd.wap.wml') > 0 || strpos($accept,'application/vnd.wap.xhtml+xml') > 0) { |
|
42 | + } elseif (strpos($this->accept, 'text/vnd.wap.wml') > 0 || strpos($accept, 'application/vnd.wap.xhtml+xml') > 0) { |
|
43 | 43 | $this->isMobile = true; |
44 | 44 | } else { |
45 | 45 | foreach ($this->devices as $device => $regexp) { |
@@ -202,7 +202,7 @@ |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
205 | - * @param null $debugBar |
|
205 | + * @param StandardDebugBar $debugBar |
|
206 | 206 | */ |
207 | 207 | public function setDebugBar($debugBar) |
208 | 208 | { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | - * @param $name |
|
91 | + * @param string $name |
|
92 | 92 | * @return AbstractLoader |
93 | 93 | */ |
94 | 94 | public function getLoader($name) |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
181 | - * @return array |
|
181 | + * @return string[] |
|
182 | 182 | */ |
183 | 183 | public function getLoaderOrder() |
184 | 184 | { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
189 | - * @return mixed |
|
189 | + * @return string |
|
190 | 190 | */ |
191 | 191 | public function getCachePath() |
192 | 192 | { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
208 | - * @param $class |
|
208 | + * @param string $class |
|
209 | 209 | * @return bool |
210 | 210 | */ |
211 | 211 | public function isClass($class) |
@@ -136,7 +136,7 @@ |
||
136 | 136 | */ |
137 | 137 | public function getLoaderClass($name) |
138 | 138 | { |
139 | - return 'Nip\AutoLoader\Loaders\\'.$name; |
|
139 | + return 'Nip\AutoLoader\Loaders\\' . $name; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -26,7 +26,7 @@ |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | - * @param bool|AutoLoader $autoLoader |
|
29 | + * @param AutoLoader $autoLoader |
|
30 | 30 | * @return $this |
31 | 31 | */ |
32 | 32 | public function setAutoLoader($autoLoader = false) |
@@ -122,7 +122,7 @@ |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
125 | - * @param $filePath |
|
125 | + * @param string $filePath |
|
126 | 126 | * @return bool |
127 | 127 | */ |
128 | 128 | protected function readCacheFile($filePath) |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $fileName = $this->getCacheName($dir); |
111 | 111 | |
112 | - return $this->getAutoLoader()->getCachePath().$fileName; |
|
112 | + return $this->getAutoLoader()->getCachePath() . $fileName; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getCacheName($dir) |
120 | 120 | { |
121 | - return Text::toAscii($dir).'.php'; |
|
121 | + return Text::toAscii($dir) . '.php'; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | - * @param $key |
|
99 | + * @param string $key |
|
100 | 100 | * @return mixed|null |
101 | 101 | */ |
102 | 102 | public function getByKey($key) |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | - * @param $path |
|
123 | + * @param string $path |
|
124 | 124 | * @return string |
125 | 125 | */ |
126 | 126 | protected function getByPath($path) |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | - * @param $path |
|
166 | + * @param string $path |
|
167 | 167 | * @return bool |
168 | 168 | */ |
169 | 169 | public function hasByPath($path) |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
219 | - * @param $name |
|
219 | + * @param string $name |
|
220 | 220 | * @param $value |
221 | 221 | * @return $this |
222 | 222 | * @throws Exception\RuntimeException |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function __construct(array $array = [], $allowModifications = false) |
44 | 44 | { |
45 | - $this->allowModifications = (bool)$allowModifications; |
|
45 | + $this->allowModifications = (bool) $allowModifications; |
|
46 | 46 | |
47 | 47 | foreach ($array as $key => $value) { |
48 | 48 | $this->setDataItem($key, $value); |
@@ -11,7 +11,6 @@ |
||
11 | 11 | /** |
12 | 12 | * Parses a file from `$path` and gets its contents as an array |
13 | 13 | * |
14 | - * @param string $path |
|
15 | 14 | * |
16 | 15 | * @return array |
17 | 16 | */ |