@@ -14,6 +14,6 @@ |
||
14 | 14 | * @param array $commander |
15 | 15 | * @return mixed |
16 | 16 | */ |
17 | - public function exception($commander=array()); |
|
17 | + public function exception($commander = array()); |
|
18 | 18 | |
19 | 19 | } |
20 | 20 | \ No newline at end of file |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | { |
28 | 28 | // we check that they are in |
29 | 29 | // the console to run the console commands in the kernel. |
30 | - if(Utils::isNamespaceExists($this->consoleClassNamespace)){ |
|
30 | + if (Utils::isNamespaceExists($this->consoleClassNamespace)) { |
|
31 | 31 | return call_user_func($callback); |
32 | 32 | } |
33 | 33 | |
34 | 34 | // if the kernel console is not found |
35 | 35 | // then we check the existence of the specific application command and run it if it is. |
36 | - return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(),$this))->handle(); |
|
36 | + return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(), $this))->handle(); |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | |
@@ -43,25 +43,25 @@ discard block |
||
43 | 43 | * @param array $args |
44 | 44 | * @return void|mixed |
45 | 45 | */ |
46 | - protected function consoleEventHandler($args=array()) |
|
46 | + protected function consoleEventHandler($args = array()) |
|
47 | 47 | { |
48 | - if(isset($this->app['eventDispatcher'])){ |
|
48 | + if (isset($this->app['eventDispatcher'])) { |
|
49 | 49 | |
50 | 50 | $listeners = event()->getListeners(); |
51 | 51 | |
52 | - if(isset($args['event']) && isset($listeners['console'])){ |
|
52 | + if (isset($args['event']) && isset($listeners['console'])) { |
|
53 | 53 | |
54 | - if(strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])){ |
|
54 | + if (strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])) { |
|
55 | 55 | |
56 | 56 | $event = $listeners['console'][strtolower($args['event'])]; |
57 | - return call_user_func_array($event,['app'=>$this->app,'args'=>$args,]); |
|
57 | + return call_user_func_array($event, ['app'=>$this->app, 'args'=>$args, ]); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - if(isset($listeners['console']['default'])){ |
|
61 | + if (isset($listeners['console']['default'])) { |
|
62 | 62 | |
63 | 63 | $event = $listeners['console']['default']; |
64 | - return call_user_func_array($event,['args'=>$args,'app'=>$this->app]); |
|
64 | + return call_user_func_array($event, ['args'=>$args, 'app'=>$this->app]); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | |
80 | 80 | //If the console executor is a custom console application; in this case we look at the kernel directory inside the application. |
81 | 81 | //If the console class is not available on the kernel of resta, then the system will run the command class in the application. |
82 | - return $this->checkConsoleNamespace(function(){ |
|
82 | + return $this->checkConsoleNamespace(function() { |
|
83 | 83 | |
84 | - if($this->isRunnableKernelCommandList()){ |
|
84 | + if ($this->isRunnableKernelCommandList()) { |
|
85 | 85 | exception()->badMethodCall('this command is not runnable'); |
86 | 86 | } |
87 | 87 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | $consoleArguments = $this->getConsoleArgumentsWithKey(); |
90 | 90 | |
91 | 91 | // we get the instance data of the kernel command class of the system. |
92 | - $commander = (new $this->consoleClassNamespace($consoleArguments,$this)); |
|
92 | + $commander = (new $this->consoleClassNamespace($consoleArguments, $this)); |
|
93 | 93 | |
94 | 94 | // we check the command rules of each command class. |
95 | - $this->prepareCommander($commander,function($commander){ |
|
95 | + $this->prepareCommander($commander, function($commander) { |
|
96 | 96 | return $commander->{$this->getConsoleClassMethod()}(); |
97 | 97 | }); |
98 | 98 | |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | public function handle() |
111 | 111 | { |
112 | 112 | //get is running console |
113 | - if($this->app->runningInConsole()){ |
|
113 | + if ($this->app->runningInConsole()) { |
|
114 | 114 | |
115 | 115 | //run console process |
116 | - if(count($this->getArguments())){ |
|
116 | + if (count($this->getArguments())) { |
|
117 | 117 | return $this->consoleProcess(); |
118 | 118 | } |
119 | 119 | |
@@ -129,24 +129,24 @@ discard block |
||
129 | 129 | * @param callable $callback |
130 | 130 | * @return mixed |
131 | 131 | */ |
132 | - protected function prepareCommander(ConsoleOutputterContracts $commander,callable $callback) |
|
132 | + protected function prepareCommander(ConsoleOutputterContracts $commander, callable $callback) |
|
133 | 133 | { |
134 | 134 | // closure binding custom command,move custom namespace as specific |
135 | 135 | // call prepare commander firstly for checking command builder |
136 | - $closureCommand = app()->resolve(ClosureDispatcher::class,['bind'=>$commander]); |
|
136 | + $closureCommand = app()->resolve(ClosureDispatcher::class, ['bind'=>$commander]); |
|
137 | 137 | |
138 | 138 | //assign commander method name |
139 | 139 | $closureCommand->prepareBind['methodName'] = $this->getConsoleClassMethod(); |
140 | 140 | |
141 | 141 | $prepareCommander = $commander->prepareCommander($closureCommand); |
142 | 142 | |
143 | - if(!$prepareCommander['status']){ |
|
143 | + if (!$prepareCommander['status']) { |
|
144 | 144 | echo $commander->exception($prepareCommander); |
145 | 145 | die(); |
146 | 146 | } |
147 | 147 | |
148 | 148 | //callback custom console |
149 | - return call_user_func_array($callback,[$commander]); |
|
149 | + return call_user_func_array($callback, [$commander]); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | $commandList = $this->app->commandList(); |
160 | 160 | |
161 | 161 | //is runnable kernel command conditions |
162 | - return !array_key_exists($this->consoleClassNamespace,$commandList) OR |
|
163 | - (array_key_exists($this->consoleClassNamespace,$commandList) AND |
|
162 | + return !array_key_exists($this->consoleClassNamespace, $commandList) OR |
|
163 | + (array_key_exists($this->consoleClassNamespace, $commandList) AND |
|
164 | 164 | !$commandList[$this->consoleClassNamespace]['isRunnable']); |
165 | 165 | } |
166 | 166 | } |
167 | 167 | \ No newline at end of file |
@@ -8,83 +8,83 @@ |
||
8 | 8 | * @param null|string $msg |
9 | 9 | * @return mixed |
10 | 10 | */ |
11 | - public function invalidArgument($msg=null); |
|
11 | + public function invalidArgument($msg = null); |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param null|string $msg |
15 | 15 | * @return mixed |
16 | 16 | */ |
17 | - public function badFunctionCall($msg=null); |
|
17 | + public function badFunctionCall($msg = null); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @param null|string $msg |
21 | 21 | * @return mixed |
22 | 22 | */ |
23 | - public function badMethodCall($msg=null); |
|
23 | + public function badMethodCall($msg = null); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @param null|string $msg |
27 | 27 | * @return mixed |
28 | 28 | */ |
29 | - public function domain($msg=null); |
|
29 | + public function domain($msg = null); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @param null|string $msg |
33 | 33 | * @return mixed |
34 | 34 | */ |
35 | - public function length($msg=null); |
|
35 | + public function length($msg = null); |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @param null|string $msg |
39 | 39 | * @return mixed |
40 | 40 | */ |
41 | - public function logic($msg=null); |
|
41 | + public function logic($msg = null); |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @param null|string $msg |
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | - public function notFoundException($msg=null); |
|
47 | + public function notFoundException($msg = null); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @param null|string $msg |
51 | 51 | * @return mixed |
52 | 52 | */ |
53 | - public function fileNotFoundException($msg=null); |
|
53 | + public function fileNotFoundException($msg = null); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @param null|string $msg |
57 | 57 | * @return mixed |
58 | 58 | */ |
59 | - public function outOfRange($msg=null); |
|
59 | + public function outOfRange($msg = null); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @param null|string $msg |
63 | 63 | * @return mixed |
64 | 64 | */ |
65 | - public function overflow($msg=null); |
|
65 | + public function overflow($msg = null); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * @param null|string $msg |
69 | 69 | * @return mixed |
70 | 70 | */ |
71 | - public function range($msg=null); |
|
71 | + public function range($msg = null); |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @param null|string $msg |
75 | 75 | * @return mixed |
76 | 76 | */ |
77 | - public function runtime($msg=null); |
|
77 | + public function runtime($msg = null); |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * @param null|string $msg |
81 | 81 | * @return mixed |
82 | 82 | */ |
83 | - public function underflow($msg=null); |
|
83 | + public function underflow($msg = null); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @param null|string $msg |
87 | 87 | * @return mixed |
88 | 88 | */ |
89 | - public function unexpectedValue($msg=null); |
|
89 | + public function unexpectedValue($msg = null); |
|
90 | 90 | } |
91 | 91 | \ No newline at end of file |
@@ -72,8 +72,7 @@ discard block |
||
72 | 72 | { |
73 | 73 | if($extension){ |
74 | 74 | $default=root.'/'.str_replace("\\","/",$class).'.php'; |
75 | - } |
|
76 | - else{ |
|
75 | + } else{ |
|
77 | 76 | $default=root.'/'.str_replace("\\","/",$class).''; |
78 | 77 | } |
79 | 78 | |
@@ -240,21 +239,32 @@ discard block |
||
240 | 239 | */ |
241 | 240 | public static function array_diff_key_recursive ($array1, $array2) |
242 | 241 | { |
243 | - if(count($array1)!==count($array2)) self::$bool[]=false; |
|
242 | + if(count($array1)!==count($array2)) { |
|
243 | + self::$bool[]=false; |
|
244 | + } |
|
244 | 245 | |
245 | 246 | foreach ($array1 as $array1_key=>$array1_value){ |
246 | 247 | |
247 | 248 | if(!is_array($array1_value)){ |
248 | - if(!array_key_exists($array1_key,$array2)) self::$bool[]=false; |
|
249 | - } |
|
250 | - else{ |
|
251 | - if(!array_key_exists($array1_key,$array2)) self::$bool[]=false; |
|
249 | + if(!array_key_exists($array1_key,$array2)) { |
|
250 | + self::$bool[]=false; |
|
251 | + } |
|
252 | + } else{ |
|
253 | + if(!array_key_exists($array1_key,$array2)) { |
|
254 | + self::$bool[]=false; |
|
255 | + } |
|
252 | 256 | |
253 | - if(!isset($array2[$array1_key]) OR !is_array($array2[$array1_key])) $array2[$array1_key]=[]; |
|
257 | + if(!isset($array2[$array1_key]) OR !is_array($array2[$array1_key])) { |
|
258 | + $array2[$array1_key]=[]; |
|
259 | + } |
|
254 | 260 | |
255 | - if(isset($array1_value[0])) $array1_value=$array1_value[0]; |
|
261 | + if(isset($array1_value[0])) { |
|
262 | + $array1_value=$array1_value[0]; |
|
263 | + } |
|
256 | 264 | |
257 | - if(isset($array2[$array1_key][0])) $array2[$array1_key]=$array2[$array1_key][0]; |
|
265 | + if(isset($array2[$array1_key][0])) { |
|
266 | + $array2[$array1_key]=$array2[$array1_key][0]; |
|
267 | + } |
|
258 | 268 | |
259 | 269 | self::array_diff_key_recursive($array1_value,$array2[$array1_key]); |
260 | 270 | } |
@@ -356,8 +366,7 @@ discard block |
||
356 | 366 | |
357 | 367 | if($reelPath===null){ |
358 | 368 | $pathWithPhpList[] = $pathWithPhp[0]; |
359 | - } |
|
360 | - else{ |
|
369 | + } else{ |
|
361 | 370 | $pathWithPhpList[] = $reelPath.'/'.$pathWithPhp[0]; |
362 | 371 | } |
363 | 372 |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | * @param bool $shift |
17 | 17 | * @return array |
18 | 18 | */ |
19 | - public static function upperCase($argument,$shift=true) |
|
19 | + public static function upperCase($argument, $shift = true) |
|
20 | 20 | { |
21 | - if($shift){ |
|
21 | + if ($shift) { |
|
22 | 22 | array_shift($argument); |
23 | 23 | } |
24 | 24 | |
25 | - return array_map(function($argument){ |
|
25 | + return array_map(function($argument) { |
|
26 | 26 | return ucfirst($argument); |
27 | 27 | },$argument); |
28 | 28 | } |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public static function strtolower($argument) |
48 | 48 | { |
49 | - if(!is_array($argument)){ |
|
49 | + if (!is_array($argument)) { |
|
50 | 50 | return strtolower($argument); |
51 | 51 | } |
52 | - return array_map(function($argument){ |
|
52 | + return array_map(function($argument) { |
|
53 | 53 | return strtolower($argument); |
54 | 54 | },$argument); |
55 | 55 | } |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | * @param array $data |
59 | 59 | * @return string |
60 | 60 | */ |
61 | - public static function generatorNamespace($data=array()) |
|
61 | + public static function generatorNamespace($data = array()) |
|
62 | 62 | { |
63 | - return str_replace('.php','',implode("\\",$data)); |
|
63 | + return str_replace('.php', '', implode("\\", $data)); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | * @param bool $extension |
69 | 69 | * @return mixed |
70 | 70 | */ |
71 | - public static function getPathFromNamespace($class,$extension=true) |
|
71 | + public static function getPathFromNamespace($class, $extension = true) |
|
72 | 72 | { |
73 | - if($extension){ |
|
74 | - $default=root.'/'.str_replace("\\","/",$class).'.php'; |
|
73 | + if ($extension) { |
|
74 | + $default = root.'/'.str_replace("\\", "/", $class).'.php'; |
|
75 | 75 | } |
76 | - else{ |
|
77 | - $default=root.'/'.str_replace("\\","/",$class).''; |
|
76 | + else { |
|
77 | + $default = root.'/'.str_replace("\\", "/", $class).''; |
|
78 | 78 | } |
79 | 79 | |
80 | - return str_replace("/App",'/src/app',$default); |
|
80 | + return str_replace("/App", '/src/app', $default); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * @param $method |
95 | 95 | * @return bool |
96 | 96 | */ |
97 | - public static function existMethod($class,$method) |
|
97 | + public static function existMethod($class, $method) |
|
98 | 98 | { |
99 | - return method_exists($class,$method); |
|
99 | + return method_exists($class, $method); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | * @param $second |
105 | 105 | * @return bool |
106 | 106 | */ |
107 | - public static function isArrayEqual($first,$second) |
|
107 | + public static function isArrayEqual($first, $second) |
|
108 | 108 | { |
109 | - return (count( $first ) == count( $second ) && !array_diff( $first, $second )); |
|
109 | + return (count($first)==count($second) && !array_diff($first, $second)); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | * @param bool $filename |
124 | 124 | * @return array |
125 | 125 | */ |
126 | - public static function glob($path,$filename=false) |
|
126 | + public static function glob($path, $filename = false) |
|
127 | 127 | { |
128 | 128 | $configList = []; |
129 | 129 | |
130 | 130 | foreach (glob($path.'/*.php') as $config) { |
131 | 131 | |
132 | - $configArray=str_replace(".php","",explode("/",$config)); |
|
133 | - $configList[end($configArray)]=$config; |
|
132 | + $configArray = str_replace(".php", "", explode("/", $config)); |
|
133 | + $configList[end($configArray)] = $config; |
|
134 | 134 | } |
135 | 135 | |
136 | - if($filename===true){ |
|
136 | + if ($filename===true) { |
|
137 | 137 | return array_keys($configList); |
138 | 138 | } |
139 | 139 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param string $seperator |
163 | 163 | * @return mixed |
164 | 164 | */ |
165 | - public static function getJustClassName($namespace,$seperator="\\") |
|
165 | + public static function getJustClassName($namespace, $seperator = "\\") |
|
166 | 166 | { |
167 | 167 | $path = explode($seperator, $namespace); |
168 | 168 | return array_pop($path); |
@@ -173,23 +173,23 @@ discard block |
||
173 | 173 | * @param array $param |
174 | 174 | * @return bool |
175 | 175 | */ |
176 | - public static function changeClass($class,$param=array()) |
|
176 | + public static function changeClass($class, $param = array()) |
|
177 | 177 | { |
178 | - $executionPath=$class; |
|
178 | + $executionPath = $class; |
|
179 | 179 | $dt = fopen($executionPath, "r"); |
180 | 180 | |
181 | - if($dt!==false){ |
|
181 | + if ($dt!==false) { |
|
182 | 182 | |
183 | 183 | $content = fread($dt, filesize($executionPath)); |
184 | 184 | fclose($dt); |
185 | 185 | |
186 | - foreach ($param as $key=>$value){ |
|
187 | - $content=str_replace($key,$value,$content); |
|
186 | + foreach ($param as $key=>$value) { |
|
187 | + $content = str_replace($key, $value, $content); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | $forWrite = fopen($executionPath, "w"); |
191 | 191 | |
192 | - if($forWrite!==false){ |
|
192 | + if ($forWrite!==false) { |
|
193 | 193 | fwrite($forWrite, $content); |
194 | 194 | fclose($forWrite); |
195 | 195 | |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | * @param $callback |
206 | 206 | * @return mixed |
207 | 207 | */ |
208 | - public static function returnCallback($data,$callback) |
|
208 | + public static function returnCallback($data, $callback) |
|
209 | 209 | { |
210 | - return call_user_func_array($callback,[$data]); |
|
210 | + return call_user_func_array($callback, [$data]); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public static function getNamespace($namespace) |
218 | 218 | { |
219 | - $rootDelete=str_replace(root.''.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'','',$namespace); |
|
219 | + $rootDelete = str_replace(root.''.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'', '', $namespace); |
|
220 | 220 | |
221 | 221 | return 'App\\'.self::generatorNamespace( |
222 | - explode(''.DIRECTORY_SEPARATOR.'',$rootDelete) |
|
222 | + explode(''.DIRECTORY_SEPARATOR.'', $rootDelete) |
|
223 | 223 | ); |
224 | 224 | |
225 | 225 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public static function callbackProcess($callback) |
232 | 232 | { |
233 | - return (is_callable($callback)) ? call_user_func_array($callback,[app()]) : $callback; |
|
233 | + return (is_callable($callback)) ? call_user_func_array($callback, [app()]) : $callback; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -238,29 +238,29 @@ discard block |
||
238 | 238 | * @param $array2 |
239 | 239 | * @return bool |
240 | 240 | */ |
241 | - public static function array_diff_key_recursive ($array1, $array2) |
|
241 | + public static function array_diff_key_recursive($array1, $array2) |
|
242 | 242 | { |
243 | - if(count($array1)!==count($array2)) self::$bool[]=false; |
|
243 | + if (count($array1)!==count($array2)) self::$bool[] = false; |
|
244 | 244 | |
245 | - foreach ($array1 as $array1_key=>$array1_value){ |
|
245 | + foreach ($array1 as $array1_key=>$array1_value) { |
|
246 | 246 | |
247 | - if(!is_array($array1_value)){ |
|
248 | - if(!array_key_exists($array1_key,$array2)) self::$bool[]=false; |
|
247 | + if (!is_array($array1_value)) { |
|
248 | + if (!array_key_exists($array1_key, $array2)) self::$bool[] = false; |
|
249 | 249 | } |
250 | - else{ |
|
251 | - if(!array_key_exists($array1_key,$array2)) self::$bool[]=false; |
|
250 | + else { |
|
251 | + if (!array_key_exists($array1_key, $array2)) self::$bool[] = false; |
|
252 | 252 | |
253 | - if(!isset($array2[$array1_key]) OR !is_array($array2[$array1_key])) $array2[$array1_key]=[]; |
|
253 | + if (!isset($array2[$array1_key]) OR !is_array($array2[$array1_key])) $array2[$array1_key] = []; |
|
254 | 254 | |
255 | - if(isset($array1_value[0])) $array1_value=$array1_value[0]; |
|
255 | + if (isset($array1_value[0])) $array1_value = $array1_value[0]; |
|
256 | 256 | |
257 | - if(isset($array2[$array1_key][0])) $array2[$array1_key]=$array2[$array1_key][0]; |
|
257 | + if (isset($array2[$array1_key][0])) $array2[$array1_key] = $array2[$array1_key][0]; |
|
258 | 258 | |
259 | - self::array_diff_key_recursive($array1_value,$array2[$array1_key]); |
|
259 | + self::array_diff_key_recursive($array1_value, $array2[$array1_key]); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | - if(in_array(false,self::$bool)){ |
|
263 | + if (in_array(false, self::$bool)) { |
|
264 | 264 | return false; |
265 | 265 | } |
266 | 266 | return true; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public static function slashToBackSlash($data) |
274 | 274 | { |
275 | - return str_replace("/","\\",$data); |
|
275 | + return str_replace("/", "\\", $data); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -282,11 +282,11 @@ discard block |
||
282 | 282 | * @param null|string $key |
283 | 283 | * @return mixed |
284 | 284 | */ |
285 | - public static function trace($debug=0,$key=null) |
|
285 | + public static function trace($debug = 0, $key = null) |
|
286 | 286 | { |
287 | 287 | $trace = debug_backtrace(); |
288 | 288 | |
289 | - if($key===null){ |
|
289 | + if ($key===null) { |
|
290 | 290 | return $trace[$debug] ?? null; |
291 | 291 | } |
292 | 292 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | */ |
299 | 299 | public static function getServiceConf() |
300 | 300 | { |
301 | - if(property_exists(core(),'serviceConf') && defined('methodName')){ |
|
301 | + if (property_exists(core(), 'serviceConf') && defined('methodName')) { |
|
302 | 302 | return core()->serviceConf; |
303 | 303 | } |
304 | 304 | return []; |
@@ -309,18 +309,18 @@ discard block |
||
309 | 309 | * @param null|string $reelPath |
310 | 310 | * @return array |
311 | 311 | */ |
312 | - public static function getPathWithPhpExtension($files,$reelPath=null) |
|
312 | + public static function getPathWithPhpExtension($files, $reelPath = null) |
|
313 | 313 | { |
314 | 314 | $pathWithPhpList = []; |
315 | 315 | |
316 | - foreach ($files as $file){ |
|
316 | + foreach ($files as $file) { |
|
317 | 317 | |
318 | - if(preg_match('@(.*).php@is',$file,$pathWithPhp)){ |
|
318 | + if (preg_match('@(.*).php@is', $file, $pathWithPhp)) { |
|
319 | 319 | |
320 | - if($reelPath===null){ |
|
320 | + if ($reelPath===null) { |
|
321 | 321 | $pathWithPhpList[] = $pathWithPhp[0]; |
322 | 322 | } |
323 | - else{ |
|
323 | + else { |
|
324 | 324 | $pathWithPhpList[] = $reelPath.'/'.$pathWithPhp[0]; |
325 | 325 | } |
326 | 326 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | */ |
337 | 337 | public static function resolverClass($class) |
338 | 338 | { |
339 | - if(self::isNamespaceExists($class)){ |
|
339 | + if (self::isNamespaceExists($class)) { |
|
340 | 340 | return app()->resolve($class); |
341 | 341 | } |
342 | 342 | |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | */ |
349 | 349 | public static function getRequestPathInfo() |
350 | 350 | { |
351 | - if(is_null(BootStaticManager::getRequestPath())){ |
|
352 | - return explode("/",request()->getPathInfo()); |
|
351 | + if (is_null(BootStaticManager::getRequestPath())) { |
|
352 | + return explode("/", request()->getPathInfo()); |
|
353 | 353 | } |
354 | 354 | return BootStaticManager::getRequestPath(); |
355 | 355 | } |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | * @param null|string $remove |
360 | 360 | * @return array |
361 | 361 | */ |
362 | - public static function removeTrace($trace,$remove=null) |
|
362 | + public static function removeTrace($trace, $remove = null) |
|
363 | 363 | { |
364 | 364 | $list = []; |
365 | 365 | |
366 | - foreach($trace as $key=>$item){ |
|
366 | + foreach ($trace as $key=>$item) { |
|
367 | 367 | |
368 | - if(isset($item['file']) && !preg_match('@'.$remove.'@',$item['file'])){ |
|
368 | + if (isset($item['file']) && !preg_match('@'.$remove.'@', $item['file'])) { |
|
369 | 369 | $list[$key] = $item; |
370 | 370 | } |
371 | 371 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $path = realpath($path) ?: $path; |
131 | 131 | $tempPath = tempnam(dirname($path), basename($path)); |
132 | 132 | // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600... |
133 | - chmod($tempPath, 0777 - umask()); |
|
133 | + chmod($tempPath, 0777-umask()); |
|
134 | 134 | file_put_contents($tempPath, $content); |
135 | 135 | rename($tempPath, $path); |
136 | 136 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $success = true; |
190 | 190 | foreach ($paths as $path) { |
191 | 191 | try { |
192 | - if (! @unlink($path)) { |
|
192 | + if (!@unlink($path)) { |
|
193 | 193 | $success = false; |
194 | 194 | } |
195 | 195 | } catch (ErrorException $e) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function link($target, $link) |
234 | 234 | { |
235 | - if (! windows_os()) { |
|
235 | + if (!windows_os()) { |
|
236 | 236 | return symlink($target, $link); |
237 | 237 | } |
238 | 238 | $mode = $this->isDirectory($target) ? 'J' : 'H'; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | public function files($directory, $hidden = false) |
394 | 394 | { |
395 | 395 | return iterator_to_array( |
396 | - Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0)->sortByName(), |
|
396 | + Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->depth(0)->sortByName(), |
|
397 | 397 | false |
398 | 398 | ); |
399 | 399 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | public function allFiles($directory, $hidden = false) |
409 | 409 | { |
410 | 410 | return iterator_to_array( |
411 | - Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->sortByName(), |
|
411 | + Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->sortByName(), |
|
412 | 412 | false |
413 | 413 | ); |
414 | 414 | } |
@@ -455,10 +455,10 @@ discard block |
||
455 | 455 | */ |
456 | 456 | public function moveDirectory($from, $to, $overwrite = false) |
457 | 457 | { |
458 | - if ($overwrite && $this->isDirectory($to) && ! $this->deleteDirectory($to)) { |
|
458 | + if ($overwrite && $this->isDirectory($to) && !$this->deleteDirectory($to)) { |
|
459 | 459 | return false; |
460 | 460 | } |
461 | - return @rename($from, $to) === true; |
|
461 | + return @rename($from, $to)===true; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -471,14 +471,14 @@ discard block |
||
471 | 471 | */ |
472 | 472 | public function copyDirectory($directory, $destination, $options = null) |
473 | 473 | { |
474 | - if (! $this->isDirectory($directory)) { |
|
474 | + if (!$this->isDirectory($directory)) { |
|
475 | 475 | return false; |
476 | 476 | } |
477 | 477 | $options = $options ?: FilesystemIterator::SKIP_DOTS; |
478 | 478 | // If the destination directory does not actually exist, we will go ahead and |
479 | 479 | // create it recursively, which just gets the destination prepared to copy |
480 | 480 | // the files over. Once we make the directory we'll proceed the copying. |
481 | - if (! $this->isDirectory($destination)) { |
|
481 | + if (!$this->isDirectory($destination)) { |
|
482 | 482 | $this->makeDirectory($destination, 0777, true); |
483 | 483 | } |
484 | 484 | $items = new FilesystemIterator($directory, $options); |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $target = $destination.'/'.$item->getBasename(); |
490 | 490 | if ($item->isDir()) { |
491 | 491 | $path = $item->getPathname(); |
492 | - if (! $this->copyDirectory($path, $target, $options)) { |
|
492 | + if (!$this->copyDirectory($path, $target, $options)) { |
|
493 | 493 | return false; |
494 | 494 | } |
495 | 495 | } |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | // location and keep looping. If for some reason the copy fails we'll bail out |
498 | 498 | // and return false, so the developer is aware that the copy process failed. |
499 | 499 | else { |
500 | - if (! $this->copy($item->getPathname(), $target)) { |
|
500 | + if (!$this->copy($item->getPathname(), $target)) { |
|
501 | 501 | return false; |
502 | 502 | } |
503 | 503 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | */ |
517 | 517 | public function deleteDirectory($directory, $preserve = false) |
518 | 518 | { |
519 | - if (! $this->isDirectory($directory)) { |
|
519 | + if (!$this->isDirectory($directory)) { |
|
520 | 520 | return false; |
521 | 521 | } |
522 | 522 | $items = new FilesystemIterator($directory); |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | // If the item is a directory, we can just recurse into the function and |
525 | 525 | // delete that sub-directory otherwise we'll just delete the file and |
526 | 526 | // keep iterating through each file until the directory is cleaned. |
527 | - if ($item->isDir() && ! $item->isLink()) { |
|
527 | + if ($item->isDir() && !$item->isLink()) { |
|
528 | 528 | $this->deleteDirectory($item->getPathname()); |
529 | 529 | } |
530 | 530 | // If the item is just a file, we can go ahead and delete it since we're |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | $this->delete($item->getPathname()); |
535 | 535 | } |
536 | 536 | } |
537 | - if (! $preserve) { |
|
537 | + if (!$preserve) { |
|
538 | 538 | @rmdir($directory); |
539 | 539 | } |
540 | 540 | return true; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | public function deleteDirectories($directory) |
550 | 550 | { |
551 | 551 | $allDirectories = $this->directories($directory); |
552 | - if (! empty($allDirectories)) { |
|
552 | + if (!empty($allDirectories)) { |
|
553 | 553 | foreach ($allDirectories as $directoryName) { |
554 | 554 | $this->deleteDirectory($directoryName); |
555 | 555 | } |
@@ -580,17 +580,17 @@ discard block |
||
580 | 580 | */ |
581 | 581 | public function getAllFilesInDirectory($dir, $recursive = true, $basedir = '', $include_dirs = false) |
582 | 582 | { |
583 | - if ($dir == '') {return array();} else {$results = array(); $subresults = array();} |
|
584 | - if (!is_dir($dir)) {$dir = dirname($dir);} // so a files path can be sent |
|
585 | - if ($basedir == '') {$basedir = realpath($dir).DIRECTORY_SEPARATOR;} |
|
583 | + if ($dir=='') {return array(); } else {$results = array(); $subresults = array(); } |
|
584 | + if (!is_dir($dir)) {$dir = dirname($dir); } // so a files path can be sent |
|
585 | + if ($basedir=='') {$basedir = realpath($dir).DIRECTORY_SEPARATOR; } |
|
586 | 586 | |
587 | 587 | $files = scandir($dir); |
588 | - foreach ($files as $key => $value){ |
|
589 | - if ( ($value != '.') && ($value != '..') ) { |
|
588 | + foreach ($files as $key => $value) { |
|
589 | + if (($value!='.') && ($value!='..')) { |
|
590 | 590 | $path = realpath($dir.DIRECTORY_SEPARATOR.$value); |
591 | 591 | if (is_dir($path)) { |
592 | 592 | // optionally include directories in file list |
593 | - if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path);} |
|
593 | + if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path); } |
|
594 | 594 | // optionally get file list for all subdirectories |
595 | 595 | if ($recursive) { |
596 | 596 | $subdirresults = $this->getAllFilesInDirectory($path, $recursive, $basedir, $include_dirs); |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | } |
604 | 604 | } |
605 | 605 | // merge the subarray to give the list of files then subdirectory files |
606 | - if (count($subresults) > 0) {$results = array_merge($subresults, $results);} |
|
606 | + if (count($subresults)>0) {$results = array_merge($subresults, $results); } |
|
607 | 607 | return $results; |
608 | 608 | } |
609 | 609 | } |
610 | 610 | \ No newline at end of file |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param null|string $msg |
29 | 29 | */ |
30 | - public function invalidArgument($msg=null) |
|
30 | + public function invalidArgument($msg = null) |
|
31 | 31 | { |
32 | 32 | throw new InvalidArgumentException($msg); |
33 | 33 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param null|string $msg |
39 | 39 | */ |
40 | - public function badFunctionCall($msg=null) |
|
40 | + public function badFunctionCall($msg = null) |
|
41 | 41 | { |
42 | 42 | throw new BadFunctionCallException($msg); |
43 | 43 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @param null|string $msg |
49 | 49 | */ |
50 | - public function badMethodCall($msg=null) |
|
50 | + public function badMethodCall($msg = null) |
|
51 | 51 | { |
52 | 52 | throw new BadMethodCallException($msg); |
53 | 53 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @param null|string $msg |
59 | 59 | */ |
60 | - public function domain($msg=null) |
|
60 | + public function domain($msg = null) |
|
61 | 61 | { |
62 | 62 | throw new DomainException($msg); |
63 | 63 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @param null|string $msg |
69 | 69 | */ |
70 | - public function length($msg=null) |
|
70 | + public function length($msg = null) |
|
71 | 71 | { |
72 | 72 | throw new LengthException($msg); |
73 | 73 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @param null|string $msg |
79 | 79 | */ |
80 | - public function logic($msg=null) |
|
80 | + public function logic($msg = null) |
|
81 | 81 | { |
82 | 82 | throw new LogicException($msg); |
83 | 83 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return null |
90 | 90 | * |
91 | 91 | */ |
92 | - public function notFoundException($msg=null) |
|
92 | + public function notFoundException($msg = null) |
|
93 | 93 | { |
94 | 94 | return $this->notFound($msg); |
95 | 95 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return mixed|void |
102 | 102 | * |
103 | 103 | */ |
104 | - public function fileNotFoundException($msg=null) |
|
104 | + public function fileNotFoundException($msg = null) |
|
105 | 105 | { |
106 | 106 | return $this->fileNotFound($msg); |
107 | 107 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @param null|string $msg |
113 | 113 | */ |
114 | - public function outOfRange($msg=null) |
|
114 | + public function outOfRange($msg = null) |
|
115 | 115 | { |
116 | 116 | throw new OutOfRangeException($msg); |
117 | 117 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @param null|string $msg |
123 | 123 | */ |
124 | - public function overflow($msg=null) |
|
124 | + public function overflow($msg = null) |
|
125 | 125 | { |
126 | 126 | throw new OverflowException($msg); |
127 | 127 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @param null|string $msg |
133 | 133 | */ |
134 | - public function range($msg=null) |
|
134 | + public function range($msg = null) |
|
135 | 135 | { |
136 | 136 | throw new RangeException($msg); |
137 | 137 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @param null|string $msg |
143 | 143 | */ |
144 | - public function runtime($msg=null) |
|
144 | + public function runtime($msg = null) |
|
145 | 145 | { |
146 | 146 | throw new RuntimeException($msg); |
147 | 147 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @param null|string $msg |
153 | 153 | */ |
154 | - public function underflow($msg=null) |
|
154 | + public function underflow($msg = null) |
|
155 | 155 | { |
156 | 156 | throw new UnderflowException($msg); |
157 | 157 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @param null|string $msg |
163 | 163 | */ |
164 | - public function unexpectedValue($msg=null) |
|
164 | + public function unexpectedValue($msg = null) |
|
165 | 165 | { |
166 | 166 | throw new UnexpectedValueException($msg); |
167 | 167 | } |
@@ -25,26 +25,26 @@ |
||
25 | 25 | * @param null|string $name |
26 | 26 | * @return array |
27 | 27 | */ |
28 | - public function container($name=null) |
|
28 | + public function container($name = null) |
|
29 | 29 | { |
30 | 30 | //check container value for kernel |
31 | - if(isset($this->instances['container'])){ |
|
31 | + if (isset($this->instances['container'])) { |
|
32 | 32 | |
33 | 33 | // if methoda is a null parameter, |
34 | 34 | // then we send direct container values. |
35 | - if(is_null($name)){ |
|
35 | + if (is_null($name)) { |
|
36 | 36 | return (array)$this->instances['container']; |
37 | 37 | } |
38 | 38 | |
39 | 39 | // if there is an existing value in the container as the method parameter, |
40 | 40 | // we send this value directly in the container. |
41 | - if(isset($this->container()[$name])){ |
|
41 | + if (isset($this->container()[$name])) { |
|
42 | 42 | return $this->container()[$name]; |
43 | 43 | } |
44 | 44 | |
45 | 45 | // if there is no $name value in the container as the method parameter, |
46 | 46 | // we check this value directly in the core object. |
47 | - if(property_exists(core(),$name)){ |
|
47 | + if (property_exists(core(), $name)) { |
|
48 | 48 | return core()->{$name}; |
49 | 49 | } |
50 | 50 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use Resta\Console\ConsoleBindings; |
8 | 8 | use Resta\Contracts\ContainerContracts; |
9 | 9 | |
10 | -class Container implements ContainerContracts,\ArrayAccess |
|
10 | +class Container implements ContainerContracts, \ArrayAccess |
|
11 | 11 | { |
12 | 12 | /** |
13 | 13 | * @var bool |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | * @param array $bind |
50 | 50 | * @return array |
51 | 51 | */ |
52 | - public function applicationProviderBinding($make,$bind=array()) |
|
52 | + public function applicationProviderBinding($make, $bind = array()) |
|
53 | 53 | { |
54 | 54 | //service container is an automatic application provider |
55 | 55 | //that we can bind to the special class di in the dependency condition. |
56 | 56 | //This method is automatically added to the classes resolved by the entire make bind method. |
57 | - return array_merge($bind,['app'=>$make]); |
|
57 | + return array_merge($bind, ['app'=>$make]); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | * @throws DependencyException |
66 | 66 | * @throws NotFoundException |
67 | 67 | */ |
68 | - public function bind($object=null,$callback=null) |
|
68 | + public function bind($object = null, $callback = null) |
|
69 | 69 | { |
70 | 70 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
71 | 71 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
72 | 72 | //the applicationProvider object and the resolve method is called |
73 | - return $this->make($object,$callback,'container'); |
|
73 | + return $this->make($object, $callback, 'container'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | * @throws DependencyException |
83 | 83 | * @throws NotFoundException |
84 | 84 | */ |
85 | - private function build($object,$callback,$sync=false) |
|
85 | + private function build($object, $callback, $sync = false) |
|
86 | 86 | { |
87 | 87 | //If the console object returns true, |
88 | 88 | //we do not cancel binding operations |
89 | 89 | //We are getting what applies to console with consoleKernelObject. |
90 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback); |
|
90 | + if ($sync===false) return $this->consoleKernelObjectChecker($object, $callback); |
|
91 | 91 | |
92 | 92 | //the value corresponding to the bind value for the global object is assigned and |
93 | 93 | //the resolve method is called for the dependency injection. |
94 | - $this->kernelAssigner()->setKernelObject($object,$callback); |
|
94 | + $this->kernelAssigner()->setKernelObject($object, $callback); |
|
95 | 95 | |
96 | 96 | //return kernel object |
97 | 97 | return $this->kernel(); |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | * @throws DependencyException |
107 | 107 | * @throws NotFoundException |
108 | 108 | */ |
109 | - private function consoleKernelObject($object,$callback,$container=false) |
|
109 | + private function consoleKernelObject($object, $callback, $container = false) |
|
110 | 110 | { |
111 | 111 | //we use the console bindings class to specify the classes to be preloaded in the console application. |
112 | 112 | //Thus, classes that can not be bound with http are called without closure in global loaders directory. |
113 | - $this->resolve(ConsoleBindings::class)->console($object,$callback,$container); |
|
113 | + $this->resolve(ConsoleBindings::class)->console($object, $callback, $container); |
|
114 | 114 | |
115 | 115 | //The console application must always return the kernel method. |
116 | 116 | return $this->kernel(); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @throws DependencyException |
126 | 126 | * @throws NotFoundException |
127 | 127 | */ |
128 | - private function consoleKernelObjectChecker($object,$callback,$container=false) |
|
128 | + private function consoleKernelObjectChecker($object, $callback, $container = false) |
|
129 | 129 | { |
130 | 130 | //we check whether the callback value is a callable function. |
131 | 131 | $isCallableForCallback = is_callable($callback); |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | //If the console object returns true, |
134 | 134 | //we do not cancel binding operations |
135 | 135 | //We are getting what applies to console with consoleKernelObject. |
136 | - if($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object,$callback,$container); |
|
136 | + if ($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object, $callback, $container); |
|
137 | 137 | |
138 | 138 | //If the application is not a console operation, we re-bind to existing methods synchronously. |
139 | - return ($container) ? $this->containerBuild($object,$callback,true) : $this->build($object,$callback,true); |
|
139 | + return ($container) ? $this->containerBuild($object, $callback, true) : $this->build($object, $callback, true); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | * @throws DependencyException |
147 | 147 | * @throws NotFoundException |
148 | 148 | */ |
149 | - private function consoleShared($object,$callback) |
|
149 | + private function consoleShared($object, $callback) |
|
150 | 150 | { |
151 | 151 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
152 | 152 | //The work to be done here is to bind the classes to be included in the console share privately. |
153 | - $this->kernelAssigner()->consoleShared($object,$callback); |
|
153 | + $this->kernelAssigner()->consoleShared($object, $callback); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | * @throws DependencyException |
163 | 163 | * @throws NotFoundException |
164 | 164 | */ |
165 | - public function containerBuild($object,$callback,$sync=false) |
|
165 | + public function containerBuild($object, $callback, $sync = false) |
|
166 | 166 | { |
167 | 167 | //If the console object returns true, |
168 | 168 | //we do not cancel binding operations |
169 | 169 | //We are getting what applies to console with consoleKernelObject. |
170 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback,true); |
|
170 | + if ($sync===false) return $this->consoleKernelObjectChecker($object, $callback, true); |
|
171 | 171 | |
172 | 172 | //Since the objects that come to the build method are objects from the container method, |
173 | 173 | //we need to automatically create a kernel object named serviceContainer in this method. |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | //the value corresponding to the bind value for the global object is assigned and |
177 | 177 | //the resolve method is called for the dependency method. |
178 | - $this->kernelAssigner()->setKernelObject($object,$callback,'serviceContainer'); |
|
178 | + $this->kernelAssigner()->setKernelObject($object, $callback, 'serviceContainer'); |
|
179 | 179 | |
180 | 180 | //return kernel object |
181 | 181 | return $this->kernel(); |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @param $class |
186 | 186 | * @param $bind |
187 | 187 | */ |
188 | - private function contextualBindCleaner($class,$bind) |
|
188 | + private function contextualBindCleaner($class, $bind) |
|
189 | 189 | { |
190 | 190 | //the context bind objects are checked again and the bind sequence submitted by |
191 | 191 | //the user is checked and forced to re-instantiate the object. |
192 | - if(isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind){ |
|
192 | + if (isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind) { |
|
193 | 193 | unset(self::$instance[$class]); |
194 | 194 | unset(self::$bindParams[$class]); |
195 | 195 | } |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | |
209 | 209 | // the has method can have a dotted string value so |
210 | 210 | // we need to be able to control the string or array within the container. |
211 | - foreach (explode(".",$abstract) as $item){ |
|
212 | - if(isset($container[$item]) || empty($container[$item])){ |
|
211 | + foreach (explode(".", $abstract) as $item) { |
|
212 | + if (isset($container[$item]) || empty($container[$item])) { |
|
213 | 213 | $container = $container[$item]; |
214 | 214 | } |
215 | - else{ |
|
215 | + else { |
|
216 | 216 | return null; |
217 | 217 | } |
218 | 218 | } |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | |
236 | 236 | // the has method can have a dotted string value so |
237 | 237 | // we need to be able to control the string or array within the container. |
238 | - foreach (explode(".",$abstract) as $item){ |
|
238 | + foreach (explode(".", $abstract) as $item) { |
|
239 | 239 | |
240 | 240 | // this blog will work |
241 | 241 | // if the data in the container loop points to an array. |
242 | - if(!is_array($container)){ |
|
242 | + if (!is_array($container)) { |
|
243 | 243 | |
244 | 244 | // we are querying the value of |
245 | 245 | // the items corresponding to the dotted value in the container. |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $container = $this->get($item); |
248 | 248 | $bools[] = is_null($container) ? false : true; |
249 | 249 | } |
250 | - else{ |
|
250 | + else { |
|
251 | 251 | |
252 | 252 | // if the container array corresponds to a string, |
253 | 253 | // the bools array is filled with the isset control directly. |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | |
258 | 258 | // the method returns false if the bools sequence is false, |
259 | 259 | // otherwise it will return true. |
260 | - return in_array(false,$bools) ? false : true; |
|
260 | + return in_array(false, $bools) ? false : true; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @throws DependencyException |
308 | 308 | * @throws NotFoundException |
309 | 309 | */ |
310 | - public function make($object=null,$callback=null,$container=false) |
|
310 | + public function make($object = null, $callback = null, $container = false) |
|
311 | 311 | { |
312 | 312 | //we check whether the boolean value of the singleton variable used |
313 | 313 | //for booting does not reset every time the object variable to be assigned to the kernel variable is true |
@@ -315,8 +315,8 @@ discard block |
||
315 | 315 | |
316 | 316 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
317 | 317 | //The work to be done here is to bind the classes to be included in the console share privately. |
318 | - if($container){ |
|
319 | - $this->consoleShared($object,$callback); |
|
318 | + if ($container) { |
|
319 | + $this->consoleShared($object, $callback); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | //If the third parameter passed to the bind method carries a container value, |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
327 | 327 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
328 | 328 | //the applicationProvider object and the resolve method is called |
329 | - return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object,$callback); |
|
329 | + return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object, $callback); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public function offsetGet($offset) { |
348 | 348 | |
349 | - return $this->resolve($this->instances['containerInstanceResolve'],[ |
|
349 | + return $this->resolve($this->instances['containerInstanceResolve'], [ |
|
350 | 350 | 'instances' => $this->instances |
351 | 351 | ])->{$offset}(); |
352 | 352 | } |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | * @param null $concrete |
371 | 371 | * @return bool|mixed |
372 | 372 | */ |
373 | - public function register($key,$object,$concrete=null) |
|
373 | + public function register($key, $object, $concrete = null) |
|
374 | 374 | { |
375 | 375 | // we assign the values required |
376 | 376 | // for register to the global value variable. |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | |
381 | 381 | // If there is an instance of the application class, |
382 | 382 | // the register method is saved both in this example and in the global. |
383 | - if(defined('appInstance')){ |
|
383 | + if (defined('appInstance')) { |
|
384 | 384 | |
385 | 385 | // where we will assign both the global instance |
386 | 386 | // and the registered application object. |
@@ -399,19 +399,19 @@ discard block |
||
399 | 399 | * @param bool $withConcrete |
400 | 400 | * @return bool |
401 | 401 | */ |
402 | - private function registerProcess($instance,$withConcrete=false) |
|
402 | + private function registerProcess($instance, $withConcrete = false) |
|
403 | 403 | { |
404 | 404 | // values recorded without concrete. |
405 | 405 | // or values deleted |
406 | - if(false===$withConcrete){ |
|
406 | + if (false===$withConcrete) { |
|
407 | 407 | |
408 | 408 | //values registered without concrete |
409 | - $instance->{$this->values['key']}=$this->values['object']; |
|
409 | + $instance->{$this->values['key']} = $this->values['object']; |
|
410 | 410 | return false; |
411 | 411 | } |
412 | 412 | |
413 | 413 | //values registered with concrete |
414 | - $instance->{$this->values['key']}[$this->values['object']]=$this->values['concrete']; |
|
414 | + $instance->{$this->values['key']}[$this->values['object']] = $this->values['concrete']; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -422,22 +422,22 @@ discard block |
||
422 | 422 | * @throws DependencyException |
423 | 423 | * @throws NotFoundException |
424 | 424 | */ |
425 | - public function resolve($class,$bind=array()) |
|
425 | + public function resolve($class, $bind = array()) |
|
426 | 426 | { |
427 | 427 | //the context bind objects are checked again and the bind sequence submitted by |
428 | 428 | //the user is checked and forced to re-instantiate the object. |
429 | - $this->contextualBindCleaner($class,$bind); |
|
429 | + $this->contextualBindCleaner($class, $bind); |
|
430 | 430 | |
431 | 431 | //We do an instance check to get the static instance values of |
432 | 432 | //the classes to be resolved with the make bind method. |
433 | - if(!isset(self::$instance[$class])){ |
|
433 | + if (!isset(self::$instance[$class])) { |
|
434 | 434 | |
435 | 435 | //bind params object |
436 | 436 | self::$bindParams[$class] = $bind; |
437 | 437 | |
438 | 438 | //By singleton checking, we solve the dependency injection of the given class. |
439 | 439 | //Thus, each class can be called together with its dependency. |
440 | - self::$instance[$class] = DIContainerManager::make($class,$this->applicationProviderBinding($this,self::$bindParams[$class])); |
|
440 | + self::$instance[$class] = DIContainerManager::make($class, $this->applicationProviderBinding($this, self::$bindParams[$class])); |
|
441 | 441 | $this->singleton()->resolved[$class] = self::$instance[$class]; |
442 | 442 | |
443 | 443 | //return resolve class |
@@ -455,9 +455,9 @@ discard block |
||
455 | 455 | * @param $class |
456 | 456 | * @return mixed |
457 | 457 | */ |
458 | - public function resolved($class){ |
|
458 | + public function resolved($class) { |
|
459 | 459 | |
460 | - if(isset($this['resolved'][$class])){ |
|
460 | + if (isset($this['resolved'][$class])) { |
|
461 | 461 | return $this['resolved'][$class]; |
462 | 462 | } |
463 | 463 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @throws DependencyException |
473 | 473 | * @throws NotFoundException |
474 | 474 | */ |
475 | - public function share($object=null,$callback=null) |
|
475 | + public function share($object = null, $callback = null) |
|
476 | 476 | { |
477 | 477 | //we check whether the boolean value of the singleton variable used |
478 | 478 | //for booting does not reset every time the object variable to be assigned to the kernel variable is true |
@@ -480,12 +480,12 @@ discard block |
||
480 | 480 | |
481 | 481 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
482 | 482 | //The work to be done here is to bind the classes to be included in the console share privately. |
483 | - $this->consoleShared($object,$callback); |
|
483 | + $this->consoleShared($object, $callback); |
|
484 | 484 | |
485 | 485 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
486 | 486 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
487 | 487 | //the applicationProvider object and the resolve method is called |
488 | - return ($object===null) ? $this->kernel() : $this->build($object,$callback); |
|
488 | + return ($object===null) ? $this->kernel() : $this->build($object, $callback); |
|
489 | 489 | |
490 | 490 | } |
491 | 491 | |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | */ |
506 | 506 | public function singleton() |
507 | 507 | { |
508 | - if($this->singleton===false){ |
|
508 | + if ($this->singleton===false) { |
|
509 | 509 | |
510 | 510 | //after first initializing, the singleton variable is set to true, |
511 | 511 | //and subsequent incoming classes can inherit the loaded object. |
@@ -526,12 +526,12 @@ discard block |
||
526 | 526 | // for application instance |
527 | 527 | // if the values to be saved are to be saved without the concrete, |
528 | 528 | // if it is an array. |
529 | - if($this->values['concrete']===null) { |
|
529 | + if ($this->values['concrete']===null) { |
|
530 | 530 | |
531 | 531 | // Without concrete, |
532 | 532 | // the saved value will be saved |
533 | 533 | // if the it does not exist in application instance. |
534 | - if(!isset($instance->{$this->values['key']})) { |
|
534 | + if (!isset($instance->{$this->values['key']})) { |
|
535 | 535 | $this->registerProcess($instance); |
536 | 536 | } |
537 | 537 | return false; |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | |
540 | 540 | // We send concrete values to be recorded with concrete as true. |
541 | 541 | // these values will be recorded as a array. |
542 | - $this->registerProcess($instance,true); |
|
542 | + $this->registerProcess($instance, true); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | /** |
@@ -547,11 +547,11 @@ discard block |
||
547 | 547 | * @param null|string $object |
548 | 548 | * @return mixed |
549 | 549 | */ |
550 | - public function terminate($key,$object=null) |
|
550 | + public function terminate($key, $object = null) |
|
551 | 551 | { |
552 | 552 | // object null is |
553 | 553 | // sent to just terminate a key. |
554 | - if($object===null){ |
|
554 | + if ($object===null) { |
|
555 | 555 | unset(core()->{$key}); |
556 | 556 | unset($this->singleton()->{$key}); |
557 | 557 | return false; |
@@ -87,7 +87,9 @@ discard block |
||
87 | 87 | //If the console object returns true, |
88 | 88 | //we do not cancel binding operations |
89 | 89 | //We are getting what applies to console with consoleKernelObject. |
90 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback); |
|
90 | + if($sync===false) { |
|
91 | + return $this->consoleKernelObjectChecker($object,$callback); |
|
92 | + } |
|
91 | 93 | |
92 | 94 | //the value corresponding to the bind value for the global object is assigned and |
93 | 95 | //the resolve method is called for the dependency injection. |
@@ -133,7 +135,9 @@ discard block |
||
133 | 135 | //If the console object returns true, |
134 | 136 | //we do not cancel binding operations |
135 | 137 | //We are getting what applies to console with consoleKernelObject. |
136 | - if($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object,$callback,$container); |
|
138 | + if($this->console() AND $isCallableForCallback) { |
|
139 | + return $this->consoleKernelObject($object,$callback,$container); |
|
140 | + } |
|
137 | 141 | |
138 | 142 | //If the application is not a console operation, we re-bind to existing methods synchronously. |
139 | 143 | return ($container) ? $this->containerBuild($object,$callback,true) : $this->build($object,$callback,true); |
@@ -167,7 +171,9 @@ discard block |
||
167 | 171 | //If the console object returns true, |
168 | 172 | //we do not cancel binding operations |
169 | 173 | //We are getting what applies to console with consoleKernelObject. |
170 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback,true); |
|
174 | + if($sync===false) { |
|
175 | + return $this->consoleKernelObjectChecker($object,$callback,true); |
|
176 | + } |
|
171 | 177 | |
172 | 178 | //Since the objects that come to the build method are objects from the container method, |
173 | 179 | //we need to automatically create a kernel object named serviceContainer in this method. |
@@ -211,8 +217,7 @@ discard block |
||
211 | 217 | foreach (explode(".",$abstract) as $item){ |
212 | 218 | if(isset($container[$item]) || empty($container[$item])){ |
213 | 219 | $container = $container[$item]; |
214 | - } |
|
215 | - else{ |
|
220 | + } else{ |
|
216 | 221 | return null; |
217 | 222 | } |
218 | 223 | } |
@@ -246,8 +251,7 @@ discard block |
||
246 | 251 | // the control result is transferred to the bools array. |
247 | 252 | $container = $this->get($item); |
248 | 253 | $bools[] = is_null($container) ? false : true; |
249 | - } |
|
250 | - else{ |
|
254 | + } else{ |
|
251 | 255 | |
252 | 256 | // if the container array corresponds to a string, |
253 | 257 | // the bools array is filled with the isset control directly. |