@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function log() |
31 | 31 | { |
32 | - if(app()->has('track.path')){ |
|
32 | + if (app()->has('track.path')) { |
|
33 | 33 | $trackPath = app()->get('track.path'); |
34 | 34 | $logger = $trackPath($this->argument); |
35 | 35 | } |
36 | - else{ |
|
36 | + else { |
|
37 | 37 | $logger = app()->path()->appLog().''.DIRECTORY_SEPARATOR.''.date('Y').''.DIRECTORY_SEPARATOR.''.date('m').''.DIRECTORY_SEPARATOR.''.date('d').'-access.log'; |
38 | 38 | } |
39 | 39 | |
40 | - if(!file_exists($logger)){ |
|
40 | + if (!file_exists($logger)) { |
|
41 | 41 | echo 'No requests for a log tracker have been detected yet.'; |
42 | 42 | echo PHP_EOL; |
43 | 43 | exit(); |
@@ -53,18 +53,18 @@ discard block |
||
53 | 53 | while (!feof($proc)) |
54 | 54 | { |
55 | 55 | $result = fread($proc, 4096); |
56 | - if(preg_match('@\{(.*)\}@',$result,$output)){ |
|
57 | - $outputArray = json_decode($output[0],1); |
|
56 | + if (preg_match('@\{(.*)\}@', $result, $output)) { |
|
57 | + $outputArray = json_decode($output[0], 1); |
|
58 | 58 | |
59 | 59 | $outputArray['trackNumber'] = ++$number; |
60 | 60 | |
61 | - if(app()->has('track.log')){ |
|
61 | + if (app()->has('track.log')) { |
|
62 | 62 | |
63 | 63 | $track = app()->get('track.log'); |
64 | - echo $track($outputArray,$this->argument); |
|
64 | + echo $track($outputArray, $this->argument); |
|
65 | 65 | } |
66 | 66 | } |
67 | - else{ |
|
67 | + else { |
|
68 | 68 | echo $result; |
69 | 69 | } |
70 | 70 | @ flush(); |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | if(app()->has('track.path')){ |
33 | 33 | $trackPath = app()->get('track.path'); |
34 | 34 | $logger = $trackPath($this->argument); |
35 | - } |
|
36 | - else{ |
|
35 | + } else{ |
|
37 | 36 | $logger = app()->path()->appLog().''.DIRECTORY_SEPARATOR.''.date('Y').''.DIRECTORY_SEPARATOR.''.date('m').''.DIRECTORY_SEPARATOR.''.date('d').'-access.log'; |
38 | 37 | } |
39 | 38 | |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | $track = app()->get('track.log'); |
64 | 63 | echo $track($outputArray,$this->argument); |
65 | 64 | } |
66 | - } |
|
67 | - else{ |
|
65 | + } else{ |
|
68 | 66 | echo $result; |
69 | 67 | } |
70 | 68 | @ flush(); |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | */ |
24 | 24 | private static function checkFile() |
25 | 25 | { |
26 | - if(!is_null(self::$singleton)) return self::$singleton; |
|
26 | + if (!is_null(self::$singleton)) return self::$singleton; |
|
27 | 27 | |
28 | - $filePortions = explode(DIRECTORY_SEPARATOR,self::$file); |
|
28 | + $filePortions = explode(DIRECTORY_SEPARATOR, self::$file); |
|
29 | 29 | $pop = array_pop($filePortions); |
30 | 30 | |
31 | - if(file_exists(implode(DIRECTORY_SEPARATOR,$filePortions)) |
|
32 | - && preg_match('@[a-zA-Z0-9]+\.json@',$pop)){ |
|
31 | + if (file_exists(implode(DIRECTORY_SEPARATOR, $filePortions)) |
|
32 | + && preg_match('@[a-zA-Z0-9]+\.json@', $pop)) { |
|
33 | 33 | self::$singleton = self::$file; |
34 | 34 | return self::$singleton; |
35 | 35 | } |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | { |
47 | 47 | $file = self::checkFile(); |
48 | 48 | |
49 | - if(!file_exists($file)){ |
|
50 | - files()->put($file,self::encode([])); |
|
49 | + if (!file_exists($file)) { |
|
50 | + files()->put($file, self::encode([])); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public static function decode($data) |
61 | 61 | { |
62 | - return json_decode($data,1); |
|
62 | + return json_decode($data, 1); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -71,26 +71,26 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @throws FileNotFoundException |
73 | 73 | */ |
74 | - public static function delete($key,$arrayKey=null) |
|
74 | + public static function delete($key, $arrayKey = null) |
|
75 | 75 | { |
76 | 76 | $data = self::get(); |
77 | 77 | |
78 | - if(is_null($arrayKey)){ |
|
78 | + if (is_null($arrayKey)) { |
|
79 | 79 | |
80 | - if(isset($data[$key])){ |
|
80 | + if (isset($data[$key])) { |
|
81 | 81 | unset($data[$key]); |
82 | - files()->put(self::checkFile(),self::encode($data),true); |
|
82 | + files()->put(self::checkFile(), self::encode($data), true); |
|
83 | 83 | return true; |
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | 87 | // if the data to be deleted |
88 | 88 | // in json data contains a nested array data. |
89 | - if(!is_null($arrayKey) && is_string($arrayKey)){ |
|
89 | + if (!is_null($arrayKey) && is_string($arrayKey)) { |
|
90 | 90 | |
91 | - if(isset($data[$key][$arrayKey])){ |
|
91 | + if (isset($data[$key][$arrayKey])) { |
|
92 | 92 | unset($data[$key][$arrayKey]); |
93 | - files()->put(self::checkFile(),self::encode($data),true); |
|
93 | + files()->put(self::checkFile(), self::encode($data), true); |
|
94 | 94 | return true; |
95 | 95 | } |
96 | 96 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public static function encode($data) |
108 | 108 | { |
109 | - return json_encode($data,JSON_PRETTY_PRINT); |
|
109 | + return json_encode($data, JSON_PRETTY_PRINT); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -132,18 +132,18 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @throws FileNotFoundException |
134 | 134 | */ |
135 | - public static function set($key,$value) |
|
135 | + public static function set($key, $value) |
|
136 | 136 | { |
137 | 137 | self::createIfNotFileExist(); |
138 | 138 | |
139 | 139 | $file = self::get(); |
140 | 140 | |
141 | - if(isset($file[$key]) && is_array($value)){ |
|
142 | - $file[$key] = array_merge($file[$key],$value); |
|
143 | - files()->put(self::checkFile(),self::encode($file)); |
|
141 | + if (isset($file[$key]) && is_array($value)) { |
|
142 | + $file[$key] = array_merge($file[$key], $value); |
|
143 | + files()->put(self::checkFile(), self::encode($file)); |
|
144 | 144 | } |
145 | - else{ |
|
146 | - files()->put(self::checkFile(),self::encode(array_merge($file,[$key=>$value]))); |
|
145 | + else { |
|
146 | + files()->put(self::checkFile(), self::encode(array_merge($file, [$key=>$value]))); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | return self::get(); |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | private static function checkFile() |
25 | 25 | { |
26 | - if(!is_null(self::$singleton)) return self::$singleton; |
|
26 | + if(!is_null(self::$singleton)) { |
|
27 | + return self::$singleton; |
|
28 | + } |
|
27 | 29 | |
28 | 30 | $filePortions = explode(DIRECTORY_SEPARATOR,self::$file); |
29 | 31 | $pop = array_pop($filePortions); |
@@ -141,8 +143,7 @@ discard block |
||
141 | 143 | if(isset($file[$key]) && is_array($value)){ |
142 | 144 | $file[$key] = array_merge($file[$key],$value); |
143 | 145 | files()->put(self::checkFile(),self::encode($file)); |
144 | - } |
|
145 | - else{ |
|
146 | + } else{ |
|
146 | 147 | files()->put(self::checkFile(),self::encode(array_merge($file,[$key=>$value]))); |
147 | 148 | } |
148 | 149 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | private static function getInstance() |
23 | 23 | { |
24 | - if(is_null(self::$singleton)){ |
|
24 | + if (is_null(self::$singleton)) { |
|
25 | 25 | self::$singleton = new Serializer(); |
26 | 26 | } |
27 | 27 |
@@ -26,29 +26,29 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @throws FileNotFoundException |
28 | 28 | */ |
29 | - private function applyProvider($key,$provider,$method='register') |
|
29 | + private function applyProvider($key, $provider, $method = 'register') |
|
30 | 30 | { |
31 | 31 | // If the provider classes are a real object |
32 | 32 | // we will run them. |
33 | - if(Utils::isNamespaceExists($provider)){ |
|
33 | + if (Utils::isNamespaceExists($provider)) { |
|
34 | 34 | |
35 | 35 | // after determining whether the register or boot methods |
36 | 36 | // we are running the provider. |
37 | 37 | /** @scrutinizer ignore-call */ |
38 | - if($this->app->runningInConsole()===false){ |
|
38 | + if ($this->app->runningInConsole()===false) { |
|
39 | 39 | $providerInstance = $this->checkInServiceJsonForProvider($provider); |
40 | 40 | } |
41 | - else{ |
|
41 | + else { |
|
42 | 42 | $providerInstance = $this->app->resolve($provider); |
43 | 43 | } |
44 | 44 | |
45 | 45 | //we need to do method check for provider. |
46 | - if(method_exists($providerInstance,$method)){ |
|
46 | + if (method_exists($providerInstance, $method)) { |
|
47 | 47 | $providerInstance->{$method}(); |
48 | 48 | |
49 | - if($method=="register"){ |
|
49 | + if ($method=="register") { |
|
50 | 50 | /** @scrutinizer ignore-call */ |
51 | - $this->app->register('loadedProviders',$key,$provider); |
|
51 | + $this->app->register('loadedProviders', $key, $provider); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | } |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | */ |
62 | 62 | private function assignerLoadedProvidersInitialCoreValue() |
63 | 63 | { |
64 | - if(!isset($this->app['loadedProviders'])){ |
|
64 | + if (!isset($this->app['loadedProviders'])) { |
|
65 | 65 | |
66 | 66 | // for loaded providers, |
67 | 67 | // we register an empty array for the container object. |
68 | 68 | /** @scrutinizer ignore-call */ |
69 | - $this->app->register('loadedProviders',[]); |
|
69 | + $this->app->register('loadedProviders', []); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | JsonHandler::$file = serviceJson(); |
84 | 84 | $data = JsonHandler::get(); |
85 | 85 | |
86 | - if(!isset($data['providers'][$provider])){ |
|
87 | - $serviceRegister = JsonHandler::set('providers',[$provider=>SerializeClassProcess::set($provider)]); |
|
86 | + if (!isset($data['providers'][$provider])) { |
|
87 | + $serviceRegister = JsonHandler::set('providers', [$provider=>SerializeClassProcess::set($provider)]); |
|
88 | 88 | } |
89 | 89 | |
90 | - if(isset($serviceRegister)){ |
|
90 | + if (isset($serviceRegister)) { |
|
91 | 91 | $data = JsonHandler::get(); |
92 | - if(!isset($data['providers'][$provider])){ |
|
92 | + if (!isset($data['providers'][$provider])) { |
|
93 | 93 | return $this->app->resolve($provider); |
94 | 94 | } |
95 | 95 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | /** @scrutinizer ignore-call */ |
109 | 109 | $providers = $this->app->serviceProviders(); |
110 | 110 | |
111 | - if(count($providers)){ |
|
111 | + if (count($providers)) { |
|
112 | 112 | $this->providers = $providers; |
113 | 113 | } |
114 | 114 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function handle() |
124 | 124 | { |
125 | - define ('serviceprovider',true); |
|
125 | + define('serviceprovider', true); |
|
126 | 126 | |
127 | 127 | //check providers and resolve |
128 | 128 | $this->resolveProviders($this->getServiceProviders()); |
@@ -135,28 +135,28 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @throws FileNotFoundException |
137 | 137 | */ |
138 | - public function resolveProviders($providers=array()) |
|
138 | + public function resolveProviders($providers = array()) |
|
139 | 139 | { |
140 | 140 | // for loaded providers, |
141 | 141 | // we register an empty array for the container object. |
142 | 142 | $this->assignerLoadedProvidersInitialCoreValue(); |
143 | 143 | |
144 | 144 | //first we are running register methods of provider classes. |
145 | - foreach($providers as $key=>$provider){ |
|
145 | + foreach ($providers as $key=>$provider) { |
|
146 | 146 | |
147 | 147 | // providers can only be installed once. |
148 | 148 | // apply providers and register for kernel |
149 | - if(!isset($this->app['loadedProviders'][$key])){ |
|
150 | - $this->applyProvider($key,$provider); |
|
149 | + if (!isset($this->app['loadedProviders'][$key])) { |
|
150 | + $this->applyProvider($key, $provider); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | 154 | //then we are running boot methods of provider classes. |
155 | - foreach($providers as $key=>$provider){ |
|
155 | + foreach ($providers as $key=>$provider) { |
|
156 | 156 | |
157 | 157 | //if the providers register is already booted. |
158 | - if(isset($this->app['loadedProviders'][$key])){ |
|
159 | - $this->applyProvider($key,$provider,'boot'); |
|
158 | + if (isset($this->app['loadedProviders'][$key])) { |
|
159 | + $this->applyProvider($key, $provider, 'boot'); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
@@ -37,8 +37,7 @@ |
||
37 | 37 | /** @scrutinizer ignore-call */ |
38 | 38 | if($this->app->runningInConsole()===false){ |
39 | 39 | $providerInstance = $this->checkInServiceJsonForProvider($provider); |
40 | - } |
|
41 | - else{ |
|
40 | + } else{ |
|
42 | 41 | $providerInstance = $this->app->resolve($provider); |
43 | 42 | } |
44 | 43 |