Completed
Push — master ( 325d09...af44b2 )
by Ma
02:19
created
src/Api/Module/Abstr/System.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Api/Module/Factory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@
 block discarded – undo
16 16
         }
17 17
 
18 18
         $className = self::MODULE_NAMESPACE.$systemPrefix.'\\'.$className;
19
-        if ( ! class_exists($className)) {
19
+        if (!class_exists($className)) {
20 20
             throw new ApiException('Invalid module given');
21 21
         }
22 22
 
23 23
         $reflectionClass = new \ReflectionClass($className);
24
-        if ( ! $reflectionClass->isSubclassOf(self::MODULE_NAMESPACE.'ModuleInterface')) {
24
+        if (!$reflectionClass->isSubclassOf(self::MODULE_NAMESPACE.'ModuleInterface')) {
25 25
             throw new ApiException('Not valid implementation of Module');
26 26
         }
27 27
 
Please login to merge, or discard this patch.
src/Api/Route/Strategy/RouteFound.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@
 block discarded – undo
43 43
      */
44 44
     private function invokeController($controllerName, $method, array $parameters)
45 45
     {
46
-        if ( ! $this->controllerFactory) {
46
+        if (!$this->controllerFactory) {
47 47
             throw new \Exception('Controller Factory invalid.');
48 48
         }
49 49
         
50 50
         $controller = $this->controllerFactory->build($controllerName);
51 51
 
52
-        if ( ! method_exists($controller, $method)) {
52
+        if (!method_exists($controller, $method)) {
53 53
             throw new \Exception("Method called '{$method}' not found in '{$controllerName}'.");
54 54
         }
55 55
         call_user_func_array([$controller, $method], $parameters);
Please login to merge, or discard this patch.
src/Api/Route/Strategy/Factory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
                 break;
24 24
         }
25 25
 
26
-        if ( ! class_exists($className)) {
26
+        if (!class_exists($className)) {
27 27
             throw new \Exception("Strategy {$className} not found");
28 28
         }
29 29
 
Please login to merge, or discard this patch.
src/Api/Bootstrap.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 use Api\Config\ConfigProxy;
4
-use Api\Controller\Factory as ControllerFactory;
5 4
 use Api\ErrorHandler;
6 5
 use Monolog\Logger;
7 6
 use Monolog\Handler\StreamHandler;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,5 +16,5 @@
 block discarded – undo
16 16
 $errorHandler = new ErrorHandler($logger);
17 17
 if ($environment == 'production') {
18 18
     set_error_handler([$errorHandler, "errorHandler"]);
19
-    set_exception_handler([$errorHandler,"exceptionHandler"]);
19
+    set_exception_handler([$errorHandler, "exceptionHandler"]);
20 20
 }
Please login to merge, or discard this patch.
src/Api/ErrorHandler.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -11,6 +11,9 @@
 block discarded – undo
11 11
         $this->logger = $logger;
12 12
     }
13 13
 
14
+    /**
15
+     * @param string $message
16
+     */
14 17
     private function buildErrorMessage($message) {
15 18
         header('Content-Type: application/json');
16 19
         die(json_encode(['error' => $message]));
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
     public function errorHandler($level, $message, $file) {
20 20
         $this->logger->addWarning($message);
21 21
         $this->buildErrorMessage('Error occur.');
22
-     }
22
+        }
23 23
 
24 24
     public function exceptionHandler($exception) {
25 25
         $this->logger->addWarning($exception->getMessage());
26 26
         $this->buildErrorMessage('Error occur.');
27
-     }
27
+        }
28 28
 }
29 29
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/Controller/Factory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
                 break;
24 24
         }
25 25
 
26
-        if ( ! class_exists($className)) {
26
+        if (!class_exists($className)) {
27 27
             throw new \Exception("Strategy {$className} not found");
28 28
         }
29 29
 
Please login to merge, or discard this patch.