@@ -23,21 +23,21 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @throws \ReflectionException |
25 | 25 | */ |
26 | - public function call($class,$param,callable $callback) |
|
26 | + public function call($class, $param, callable $callback) |
|
27 | 27 | { |
28 | 28 | // We use the reflection class to solve |
29 | 29 | // the parameters of the class's methods. |
30 | - $param = $this->reflectionMethodParameters($class,$param); |
|
30 | + $param = $this->reflectionMethodParameters($class, $param); |
|
31 | 31 | |
32 | 32 | // the results of a number of processes will be given |
33 | 33 | // before the container pipeline method is given. |
34 | 34 | return $this->app->resolve(ContainerPipelineResolve::class)->handle( |
35 | - function() use($class,$param,$callback) |
|
35 | + function() use($class, $param, $callback) |
|
36 | 36 | { |
37 | 37 | // as a result |
38 | 38 | // we return the resolved class to the callback class |
39 | - $params = (object)['class'=>$class,'param'=>$param]; |
|
40 | - return call_user_func_array($callback,[$params]); |
|
39 | + $params = (object)['class'=>$class, 'param'=>$param]; |
|
40 | + return call_user_func_array($callback, [$params]); |
|
41 | 41 | }); |
42 | 42 | |
43 | 43 | } |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | * @param $parameter |
50 | 50 | * @return array |
51 | 51 | */ |
52 | - private function checkParameterForContainer($containers,$parameter) |
|
52 | + private function checkParameterForContainer($containers, $parameter) |
|
53 | 53 | { |
54 | 54 | $containerParameterNameValue = false; |
55 | 55 | |
56 | - if(isset($containers[$parameter->getType()->getName()])){ |
|
56 | + if (isset($containers[$parameter->getType()->getName()])) { |
|
57 | 57 | $parameterNameResolve = $parameter->getType()->getName(); |
58 | 58 | $containerParameterNameValue = true; |
59 | 59 | } |
60 | 60 | |
61 | - if(!$containerParameterNameValue && isset($containers[$parameter->getName()])){ |
|
61 | + if (!$containerParameterNameValue && isset($containers[$parameter->getName()])) { |
|
62 | 62 | $parameterNameResolve = $parameter->getName(); |
63 | 63 | $containerParameterNameValue = true; |
64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // if the parameter is an object and |
67 | 67 | // this object is a service container object |
68 | 68 | // then the parameter will bind. |
69 | - if($parameter->getType()!==null && $containerParameterNameValue){ |
|
69 | + if ($parameter->getType()!==null && $containerParameterNameValue) { |
|
70 | 70 | |
71 | 71 | // Unpack the container object and |
72 | 72 | // bind it to the param variable. |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | return [$parameterName=>$parameterResolve]; |
86 | 86 | } |
87 | 87 | |
88 | - if($parameter->getType()!== NULL && Utils::isNamespaceExists($parameterNameResolve)){ |
|
88 | + if ($parameter->getType()!==NULL && Utils::isNamespaceExists($parameterNameResolve)) { |
|
89 | 89 | |
90 | 90 | // Unpack the container object and |
91 | 91 | // bind it to the param variable. |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | */ |
109 | 109 | private function getReflectionMethod($class) |
110 | 110 | { |
111 | - if(!isset($class[0],$class[1])){ |
|
111 | + if (!isset($class[0], $class[1])) { |
|
112 | 112 | exception('containerResolvingMissing') |
113 | 113 | ->runtime('Container class resolving is missing'); |
114 | 114 | } |
115 | 115 | |
116 | - [$class,$method] = [$class[0],$class[1]]; |
|
116 | + [$class, $method] = [$class[0], $class[1]]; |
|
117 | 117 | |
118 | 118 | return $this->instanceReflection($this->app['reflection']($class)) |
119 | 119 | ->reflectionMethodParams($method); |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @param $instance |
126 | 126 | * @return object|null |
127 | 127 | */ |
128 | - public function instanceReflection($instance=null) |
|
128 | + public function instanceReflection($instance = null) |
|
129 | 129 | { |
130 | - if(is_object($instance) && is_null(static::$reflectionInstance)){ |
|
130 | + if (is_object($instance) && is_null(static::$reflectionInstance)) { |
|
131 | 131 | static::$reflectionInstance = $instance; |
132 | 132 | } |
133 | 133 | |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @throws \ReflectionException |
145 | 145 | */ |
146 | - private function reflectionMethodParameters($class,$param) |
|
146 | + private function reflectionMethodParameters($class, $param) |
|
147 | 147 | { |
148 | 148 | $containers = []; |
149 | 149 | |
150 | 150 | //get service container objects. |
151 | - if(isset($this->app['serviceContainer'])){ |
|
151 | + if (isset($this->app['serviceContainer'])) { |
|
152 | 152 | $containers = $this->app['serviceContainer']; |
153 | 153 | } |
154 | 154 | |
@@ -161,23 +161,23 @@ discard block |
||
161 | 161 | // we provide the user with the container method document and take action. |
162 | 162 | // thus, we help the methods to have a cleaner code structure. |
163 | 163 | $this->app->resolve(ContainerMethodDocumentResolver::class, |
164 | - ['reflection'=>$this->instanceReflection(),'class'=>$class]); |
|
164 | + ['reflection'=>$this->instanceReflection(), 'class'=>$class]); |
|
165 | 165 | |
166 | 166 | // we group the parameters into type and |
167 | 167 | // name and bind them with the necessary logic. |
168 | - foreach ($parameters as $parameter){ |
|
168 | + foreach ($parameters as $parameter) { |
|
169 | 169 | |
170 | 170 | // if the parameter is an object and |
171 | 171 | // this object is a service container object |
172 | 172 | // then the parameter will bind. |
173 | - $checkParameterForContainer = $this->checkParameterForContainer($containers,$parameter); |
|
173 | + $checkParameterForContainer = $this->checkParameterForContainer($containers, $parameter); |
|
174 | 174 | |
175 | - $paramMerge = array_merge($param,$checkParameterForContainer); |
|
175 | + $paramMerge = array_merge($param, $checkParameterForContainer); |
|
176 | 176 | |
177 | 177 | // we do some useful logic bind for user benefit. |
178 | - $param = app()->resolve(GraceContainer::class,[ |
|
178 | + $param = app()->resolve(GraceContainer::class, [ |
|
179 | 179 | 'reflection' => $reflection->reflection |
180 | - ])->graceContainerBuilder($parameter,$paramMerge); |
|
180 | + ])->graceContainerBuilder($parameter, $paramMerge); |
|
181 | 181 | |
182 | 182 | } |
183 | 183 |