@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if (json_last_error() !== JSON_ERROR_NONE) { |
48 | 48 | throw new \Exception('Can\'t parse config'); |
49 | 49 | } |
50 | - return (array) $decodedData; |
|
50 | + return (array)$decodedData; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | private function isFileReadable($fullPath) |
58 | 58 | { |
59 | - if (! is_readable($fullPath)) { |
|
59 | + if (!is_readable($fullPath)) { |
|
60 | 60 | throw new \Exception('config is not readable'); |
61 | 61 | } |
62 | 62 | } |
@@ -13,8 +13,8 @@ |
||
13 | 13 | |
14 | 14 | public function createFormat($type) |
15 | 15 | { |
16 | - if (! array_key_exists($type, $this->types) |
|
17 | - || ! class_exists($this->types[$type]) |
|
16 | + if (!array_key_exists($type, $this->types) |
|
17 | + || !class_exists($this->types[$type]) |
|
18 | 18 | ) { |
19 | 19 | throw new ApiException('Format Type: '.$type.' not found.'); |
20 | 20 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | unset($attributes['method']); |
64 | 64 | unset($attributes['controller']); |
65 | 65 | $parameters = array_merge(['container' => $this->container], $attributes); |
66 | - $route= new RouteFound($controller, $method, $parameters); |
|
66 | + $route = new RouteFound($controller, $method, $parameters); |
|
67 | 67 | $route->render(); |
68 | 68 | } |
69 | 69 | } |
@@ -45,13 +45,13 @@ |
||
45 | 45 | */ |
46 | 46 | private function invokeController($controllerName, $method, array $parameters) |
47 | 47 | { |
48 | - if (! $this->controllerFactory) { |
|
48 | + if (!$this->controllerFactory) { |
|
49 | 49 | throw new \Exception('Controller Factory invalid.'); |
50 | 50 | } |
51 | 51 | |
52 | 52 | $controller = $this->controllerFactory->build($controllerName); |
53 | 53 | |
54 | - if (! method_exists($controller, $method)) { |
|
54 | + if (!method_exists($controller, $method)) { |
|
55 | 55 | throw new \Exception("Method called '{$method}' not found in '{$controllerName}'."); |
56 | 56 | } |
57 | 57 | call_user_func_array([$controller, $method], $parameters); |
@@ -10,7 +10,7 @@ |
||
10 | 10 | public function build($name) |
11 | 11 | { |
12 | 12 | $className = $this->namespace.$name; |
13 | - if (! class_exists($className)) { |
|
13 | + if (!class_exists($className)) { |
|
14 | 14 | throw new ControllerException($className.' class not found.'); |
15 | 15 | } |
16 | 16 | return new $className; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | is_null($pingHostname) ? $config->hostToPing = $config->defaultHostToPing : $config->hostToPing = $pingHostname; |
19 | 19 | $this->addModules($container->get('ModuleFacade'), $config); |
20 | 20 | $renderData = $container->get('ModuleFacade')->returnModulesData(); |
21 | - if (! $this->canUserPassWhiteList($ip, $config)) { |
|
21 | + if (!$this->canUserPassWhiteList($ip, $config)) { |
|
22 | 22 | $renderData = ['error' => 'Your ip is not on whitelist.']; |
23 | 23 | } |
24 | 24 | $response = $this->renderFormat( |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | private function canUserPassWhiteList($clientIp, Config $config) |
34 | 34 | { |
35 | 35 | if ($config->whitelistEnabled) { |
36 | - if (! in_array($clientIp, $config->whitelist)) { |
|
36 | + if (!in_array($clientIp, $config->whitelist)) { |
|
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | } |
@@ -17,12 +17,12 @@ |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | $className = self::MODULE_NAMESPACE.$systemPrefix.'\\'.$className; |
20 | - if (! class_exists($className)) { |
|
20 | + if (!class_exists($className)) { |
|
21 | 21 | throw new ApiException('Invalid module given'); |
22 | 22 | } |
23 | 23 | |
24 | 24 | $reflectionClass = new \ReflectionClass($className); |
25 | - if (! $reflectionClass->isSubclassOf(self::CONTRACT_NAMESPACE.'ModuleInterface')) { |
|
25 | + if (!$reflectionClass->isSubclassOf(self::CONTRACT_NAMESPACE.'ModuleInterface')) { |
|
26 | 26 | throw new ApiException('Not valid implementation of Module'); |
27 | 27 | } |
28 | 28 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | if (func_num_args() != 2) { |
17 | 17 | throw new \InvalidArgumentException('Bad number of arguments'); |
18 | 18 | } |
19 | - if (! class_exists('\Memcached')) { |
|
19 | + if (!class_exists('\Memcached')) { |
|
20 | 20 | throw new ModuleException('Can\'t find Memcached class'); |
21 | 21 | } |
22 | 22 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function returnData() |
31 | 31 | { |
32 | 32 | $memcachedStats = $this->memcached->getstats(); |
33 | - $statsArr = $memcachedStats[$this->ip . ":" . $this->port]; |
|
33 | + $statsArr = $memcachedStats[$this->ip.":".$this->port]; |
|
34 | 34 | return array( |
35 | 35 | 'memcache_get' => $statsArr['cmd_get'], |
36 | 36 | 'memcache_hits' => $statsArr['get_hits'], |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | protected function getPing($server_host, $port = 80, $timeout = 1) |
38 | 38 | { |
39 | 39 | $pingMs = 0; |
40 | - if (! function_exists('fSockOpen')) { |
|
40 | + if (!function_exists('fSockOpen')) { |
|
41 | 41 | return 0; |
42 | 42 | } |
43 | 43 | $pingStart = microtime(true); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | protected function getHostname() |
54 | 54 | { |
55 | - if (! function_exists("gethostname")) { |
|
55 | + if (!function_exists("gethostname")) { |
|
56 | 56 | $ip = $_SERVER['SERVER_ADDR']; |
57 | 57 | return gethostbyaddr($ip); |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | protected function getDiskTotal() |
64 | 64 | { |
65 | - if (! function_exists('disk_total_space')) { |
|
65 | + if (!function_exists('disk_total_space')) { |
|
66 | 66 | return 0; |
67 | 67 | } |
68 | 68 | return (float)disk_total_space("/"); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | protected function getDiskFree() |
72 | 72 | { |
73 | - if (! function_exists('disk_free_space')) { |
|
73 | + if (!function_exists('disk_free_space')) { |
|
74 | 74 | return 0; |
75 | 75 | } |
76 | 76 | return (float)disk_free_space("/"); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | protected function getAvgLoad() |
80 | 80 | { |
81 | - if (! function_exists('sys_getloadavg')) { |
|
81 | + if (!function_exists('sys_getloadavg')) { |
|
82 | 82 | return 0; |
83 | 83 | } |
84 | 84 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | protected function getMemory() |
90 | 90 | { |
91 | 91 | $meminfoFile = file_get_contents('/proc/meminfo', false); |
92 | - if (! (bool)$meminfoFile) { |
|
92 | + if (!(bool)$meminfoFile) { |
|
93 | 93 | return 0; |
94 | 94 | } |
95 | 95 | |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | |
113 | 113 | protected function getCores() |
114 | 114 | { |
115 | - if (! is_readable('/proc/stat')) { |
|
115 | + if (!is_readable('/proc/stat')) { |
|
116 | 116 | return 0; |
117 | 117 | } |
118 | 118 | |
119 | 119 | $coreFile = file_get_contents('/proc/stat', false); |
120 | - if (! $coreFile) { |
|
120 | + if (!$coreFile) { |
|
121 | 121 | return 0; |
122 | 122 | } |
123 | 123 |