@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @param callable|null $func |
12 | 12 | * @return string |
13 | 13 | */ |
14 | - public function getNamespaceForAutoService($instance,callable $func = null) |
|
14 | + public function getNamespaceForAutoService($instance, callable $func = null) |
|
15 | 15 | { |
16 | 16 | //get namespace for auto service |
17 | 17 | $autoServiceNamespace = $instance->autoService(); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $configAutoServices = config('autoservices'); |
22 | 22 | |
23 | 23 | //auto service is invoked if auto service is allowed for any class yada config. |
24 | - if(class_exists($autoServiceNamespace) && $configAutoServices[strtolower(endpoint)]){ |
|
24 | + if (class_exists($autoServiceNamespace) && $configAutoServices[strtolower(endpoint)]) { |
|
25 | 25 | return $autoServiceNamespace; |
26 | 26 | } |
27 | 27 |
@@ -52,7 +52,7 @@ |
||
52 | 52 | { |
53 | 53 | // detects where the route path is coming from |
54 | 54 | // and returns this data in the static path. |
55 | - $trace = Utils::trace(2,'file'); |
|
55 | + $trace = Utils::trace(2, 'file'); |
|
56 | 56 | |
57 | 57 | // the trace is returned if the variable is available |
58 | 58 | // in the path data, otherwise it returns null. |
@@ -12,17 +12,17 @@ |
||
12 | 12 | */ |
13 | 13 | public function watch(callable $callback) |
14 | 14 | { |
15 | - if(config('app.watch')){ |
|
15 | + if (config('app.watch')) { |
|
16 | 16 | |
17 | 17 | // the memory usage component provides |
18 | 18 | // a way to profile code. |
19 | 19 | $memoryUsage = memory_get_usage(); |
20 | 20 | |
21 | 21 | //get controller output |
22 | - $controllerOutput=call_user_func($callback); |
|
22 | + $controllerOutput = call_user_func($callback); |
|
23 | 23 | |
24 | 24 | //save to kernel for a variable named controller Watch |
25 | - $this->app->register('controllerWatch', 'memory',memory_get_usage() - $memoryUsage); |
|
25 | + $this->app->register('controllerWatch', 'memory', memory_get_usage()-$memoryUsage); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | // if watch config is true; in this case |
@@ -203,8 +203,7 @@ |
||
203 | 203 | if(file_exists($routeMapper) && !isset(static::$paths[$routeMapper])){ |
204 | 204 | static::$paths[$routeMapper] = $routeDefinitor['controllerPath']; |
205 | 205 | } |
206 | - } |
|
207 | - else{ |
|
206 | + } else{ |
|
208 | 207 | |
209 | 208 | // if there is no endpoint, |
210 | 209 | // all files in the path of the route are transferred to path. |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | * @param $urlRoute |
44 | 44 | * @return int|string |
45 | 45 | */ |
46 | - public static function checkArrayEqual($patterns,$urlRoute) |
|
46 | + public static function checkArrayEqual($patterns, $urlRoute) |
|
47 | 47 | { |
48 | 48 | // calculates the equality difference between |
49 | 49 | // the route pattern and the urlRoute value. |
50 | - foreach ($patterns as $key=>$pattern){ |
|
50 | + foreach ($patterns as $key=>$pattern) { |
|
51 | 51 | |
52 | - if(Utils::isArrayEqual($pattern,$urlRoute)){ |
|
52 | + if (Utils::isArrayEqual($pattern, $urlRoute)) { |
|
53 | 53 | return $key; |
54 | 54 | } |
55 | 55 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $route = self::getRouteResolve(); |
70 | 70 | |
71 | - if(isset($route['class'])){ |
|
71 | + if (isset($route['class'])) { |
|
72 | 72 | return $route['class']; |
73 | 73 | } |
74 | 74 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $route = self::getRouteResolve(); |
86 | 86 | |
87 | - if(isset($route['controller'],$route['namespace'])){ |
|
87 | + if (isset($route['controller'], $route['namespace'])) { |
|
88 | 88 | return $route['controller'].'/'.$route['namespace']; |
89 | 89 | } |
90 | 90 | |
@@ -101,17 +101,17 @@ discard block |
||
101 | 101 | // get routes data and the resolving pattern |
102 | 102 | // Both are interrelated. |
103 | 103 | $routes = self::getRoutes(); |
104 | - $patternResolve = app()->resolve(RouteMatching::class,['route'=>new self()])->getPatternResolve(); |
|
104 | + $patternResolve = app()->resolve(RouteMatching::class, ['route'=>new self()])->getPatternResolve(); |
|
105 | 105 | |
106 | 106 | // we set the route variables for the route assistant. |
107 | 107 | self::updateRouteParameters($patternResolve); |
108 | 108 | |
109 | 109 | //if routes data is available in pattern resolve. |
110 | - if(isset($routes['data'][$patternResolve])){ |
|
110 | + if (isset($routes['data'][$patternResolve])) { |
|
111 | 111 | |
112 | 112 | // if the incoming http value is |
113 | 113 | // the same as the real request method, the data is processed. |
114 | - if($routes['data'][$patternResolve]['http'] == strtolower(httpMethod)){ |
|
114 | + if ($routes['data'][$patternResolve]['http']==strtolower(httpMethod)) { |
|
115 | 115 | |
116 | 116 | // we are set the solved pattern to a variable. |
117 | 117 | $resolve = $routes['data'][$patternResolve]; |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | { |
139 | 139 | $list = []; |
140 | 140 | |
141 | - if(isset(static::$routes['pattern'][$patternResolvedKey])){ |
|
141 | + if (isset(static::$routes['pattern'][$patternResolvedKey])) { |
|
142 | 142 | |
143 | 143 | $routeParameters = static::$routes['pattern'][$patternResolvedKey]; |
144 | 144 | $route = route(); |
145 | 145 | |
146 | - foreach($routeParameters as $key=>$param){ |
|
146 | + foreach ($routeParameters as $key=>$param) { |
|
147 | 147 | |
148 | - $param = Str::replaceWordArray(['{','}','?'],'',$param); |
|
148 | + $param = Str::replaceWordArray(['{', '}', '?'], '', $param); |
|
149 | 149 | |
150 | - if(isset($route[$key])){ |
|
150 | + if (isset($route[$key])) { |
|
151 | 151 | $list[$param] = $route[$key]; |
152 | 152 | } |
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | - app()->register('routeParams',$list); |
|
156 | + app()->register('routeParams', $list); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | { |
166 | 166 | // we will record the path data for the route. |
167 | 167 | // We set the routeMapper variables and the route path. |
168 | - self::setPath(function(){ |
|
168 | + self::setPath(function() { |
|
169 | 169 | |
170 | 170 | // we are sending |
171 | 171 | // the controller and routes.php path. |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | // in the paths data, |
179 | 179 | // we run the route mapper values and the route files one by one. |
180 | - foreach (self::$paths as $mapper=>$controller){ |
|
180 | + foreach (self::$paths as $mapper=>$controller) { |
|
181 | 181 | core()->fileSystem->callFile($mapper); |
182 | 182 | } |
183 | 183 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | { |
192 | 192 | $routeDefinitor = call_user_func($callback); |
193 | 193 | |
194 | - if(isset($routeDefinitor['controllerPath']) && isset($routeDefinitor['routePath'])){ |
|
194 | + if (isset($routeDefinitor['controllerPath']) && isset($routeDefinitor['routePath'])) { |
|
195 | 195 | |
196 | 196 | //the route paths to be saved to the mappers static property. |
197 | 197 | static::$mappers['routePaths'][] = $routeDefinitor['routePath']; |
@@ -199,22 +199,22 @@ discard block |
||
199 | 199 | |
200 | 200 | // if there is endpoint, |
201 | 201 | // then only that endpoint is transferred into the path |
202 | - if(defined('endpoint')){ |
|
202 | + if (defined('endpoint')) { |
|
203 | 203 | |
204 | 204 | $routeName = endpoint.'Route.php'; |
205 | 205 | $routeMapper = $routeDefinitor['routePath'].''.DIRECTORY_SEPARATOR.''.$routeName; |
206 | 206 | |
207 | - if(file_exists($routeMapper) && !isset(static::$paths[$routeMapper])){ |
|
207 | + if (file_exists($routeMapper) && !isset(static::$paths[$routeMapper])) { |
|
208 | 208 | static::$paths[$routeMapper] = $routeDefinitor['controllerPath']; |
209 | 209 | } |
210 | 210 | } |
211 | - else{ |
|
211 | + else { |
|
212 | 212 | |
213 | 213 | // if there is no endpoint, |
214 | 214 | // all files in the path of the route are transferred to path. |
215 | 215 | $allFilesInThatRoutePath = Utils::glob($routeDefinitor['routePath']); |
216 | 216 | |
217 | - foreach ($allFilesInThatRoutePath as $item){ |
|
217 | + foreach ($allFilesInThatRoutePath as $item) { |
|
218 | 218 | static::$paths[$item] = $routeDefinitor['controllerPath']; |
219 | 219 | } |
220 | 220 | } |
@@ -228,13 +228,13 @@ discard block |
||
228 | 228 | * @param $function |
229 | 229 | * @param null $controller |
230 | 230 | */ |
231 | - public static function setRoute($params,$function,$controller=null) |
|
231 | + public static function setRoute($params, $function, $controller = null) |
|
232 | 232 | { |
233 | - [$pattern,$route] = $params; |
|
234 | - [$class,$method] = explode("@",$route); |
|
233 | + [$pattern, $route] = $params; |
|
234 | + [$class, $method] = explode("@", $route); |
|
235 | 235 | |
236 | 236 | $patternList = array_values( |
237 | - array_filter(explode("/",$pattern),'strlen') |
|
237 | + array_filter(explode("/", $pattern), 'strlen') |
|
238 | 238 | ); |
239 | 239 | |
240 | 240 | static::$routes['pattern'][] = $patternList; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | 'http' => $function, |
245 | 245 | 'controller' => $controller, |
246 | 246 | 'namespace' => static::$namespace, |
247 | - 'endpoint' => strtolower(str_replace(StaticPathList::$controllerBundleName,'',static::$namespace)) |
|
247 | + 'endpoint' => strtolower(str_replace(StaticPathList::$controllerBundleName, '', static::$namespace)) |
|
248 | 248 | ]; |
249 | 249 | } |
250 | 250 | |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | * @param null $value |
255 | 255 | * @return bool |
256 | 256 | */ |
257 | - public static function isMatchVaribleRegexPattern($value=null) |
|
257 | + public static function isMatchVaribleRegexPattern($value = null) |
|
258 | 258 | { |
259 | 259 | // determines if the variable that can be used |
260 | 260 | // in the route file meets the regex rule. |
261 | - return (preg_match('@\{(.*?)\}@is',$value)) ? true : false; |
|
261 | + return (preg_match('@\{(.*?)\}@is', $value)) ? true : false; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | * @param null $value |
269 | 269 | * @return bool |
270 | 270 | */ |
271 | - public static function isOptionalVaribleRegexPattern($value=null) |
|
271 | + public static function isOptionalVaribleRegexPattern($value = null) |
|
272 | 272 | { |
273 | 273 | // determines if the variable that can be used |
274 | 274 | // in the route file meets the regex rule. |
275 | - return preg_match('@\{[a-z]+\?\}@is',$value) ? true : false; |
|
275 | + return preg_match('@\{[a-z]+\?\}@is', $value) ? true : false; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * @var array $routerSpecification |
11 | 11 | */ |
12 | - protected $routerSpecification=[ |
|
12 | + protected $routerSpecification = [ |
|
13 | 13 | 'pickRouter', |
14 | 14 | 'stackRouter' |
15 | 15 | ]; |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | */ |
20 | 20 | private function pickRouter() |
21 | 21 | { |
22 | - $singleton=core(); |
|
23 | - $singleton->routerSpecifications['router']=(isset($singleton->pick)) ? $singleton->pick[0] : $singleton->routerResult; |
|
22 | + $singleton = core(); |
|
23 | + $singleton->routerSpecifications['router'] = (isset($singleton->pick)) ? $singleton->pick[0] : $singleton->routerResult; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | //These are the customizations that are available in the routerSpecification object. |
33 | 33 | //By running these individually, we assign reference values to the router variable, |
34 | 34 | //which is the actual kernel object, so route customization takes place. |
35 | - return $this->routerProcess(function($router){ |
|
35 | + return $this->routerProcess(function($router) { |
|
36 | 36 | return $router; |
37 | 37 | }); |
38 | 38 | } |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | private function routerProcess(callable $callback) |
45 | 45 | { |
46 | 46 | //After running the router specification sequence one by one, we collect reference values for the kernel router. |
47 | - array_walk($this->routerSpecification,[$this,'routerSpecification']); |
|
47 | + array_walk($this->routerSpecification, [$this, 'routerSpecification']); |
|
48 | 48 | |
49 | 49 | //Then we return the routerSpecifications object that is assigned for the kernel to the router method. |
50 | - return call_user_func_array($callback,[core()->routerSpecifications['router']]); |
|
50 | + return call_user_func_array($callback, [core()->routerSpecifications['router']]); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @param $specification |
55 | 55 | * @param $key |
56 | 56 | */ |
57 | - private function routerSpecification($specification,$key) |
|
57 | + private function routerSpecification($specification, $key) |
|
58 | 58 | { |
59 | 59 | $this->{$specification}(); |
60 | 60 | } |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | //if there is no singleton pick |
72 | 72 | //If this is the case, we collect these values and assign them to the router variable. |
73 | 73 | //if it is not, the router will send the default value to the output. |
74 | - if(!isset($singleton->pick)){ |
|
75 | - $singleton->routerSpecifications['router']=(isset($singleton->stack)) ? $singleton->stack : $singleton->routerResult; |
|
74 | + if (!isset($singleton->pick)) { |
|
75 | + $singleton->routerSpecifications['router'] = (isset($singleton->stack)) ? $singleton->stack : $singleton->routerResult; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public static function delete(...$params) : void |
16 | 16 | { |
17 | 17 | // the DELETE method deletes the specified resource. |
18 | - static::setRoute($params,__FUNCTION__,static::getTracePath()); |
|
18 | + static::setRoute($params, __FUNCTION__, static::getTracePath()); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | // the GET method requests a representation of the specified resource. |
30 | 30 | // Requests using GET should only retrieve data. |
31 | - static::setRoute($params,__FUNCTION__,static::getTracePath()); |
|
31 | + static::setRoute($params, __FUNCTION__, static::getTracePath()); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | // the POST method is used to submit an entity to the specified resource, |
60 | 60 | // often causing a change in state or side effects on the server. |
61 | - static::setRoute($params,__FUNCTION__,static::getTracePath()); |
|
61 | + static::setRoute($params, __FUNCTION__, static::getTracePath()); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | // the PUT method replaces all current representations of |
73 | 73 | // the target resource with the request payload. |
74 | - static::setRoute($params,__FUNCTION__,static::getTracePath()); |
|
74 | + static::setRoute($params, __FUNCTION__, static::getTracePath()); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * @param bool $objectReturn |
26 | 26 | * @return mixed |
27 | 27 | */ |
28 | - public function login($credentials=array(),$objectReturn=false); |
|
28 | + public function login($credentials = array(), $objectReturn = false); |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @return mixed |
@@ -12,20 +12,20 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * @var bool |
14 | 14 | */ |
15 | - protected $using=false; |
|
15 | + protected $using = false; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * AuthLoginManager constructor. |
19 | 19 | * @param $credentials |
20 | 20 | * @param \Resta\Authenticate\AuthenticateProvider $auth |
21 | 21 | */ |
22 | - public function __construct($credentials,$auth) |
|
22 | + public function __construct($credentials, $auth) |
|
23 | 23 | { |
24 | 24 | parent::__construct($auth); |
25 | 25 | |
26 | 26 | // where the control mechanism of the credentials |
27 | 27 | // values received from the user-defined yada config setting is made. |
28 | - $this->credentials=new AuthLoginCredentialsManager($this->getCredentials($credentials),$this->using); |
|
28 | + $this->credentials = new AuthLoginCredentialsManager($this->getCredentials($credentials), $this->using); |
|
29 | 29 | |
30 | 30 | //query login |
31 | 31 | $this->loginProcess(); |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | // if the user is not going to use the config setting, |
40 | 40 | // then in this case it can attempt to login by sending parameters |
41 | 41 | // as an array to the login method. |
42 | - if(is_array($credentials) && count($credentials)){ |
|
42 | + if (is_array($credentials) && count($credentials)) { |
|
43 | 43 | |
44 | - $this->using=true; |
|
44 | + $this->using = true; |
|
45 | 45 | return $credentials; |
46 | 46 | } |
47 | 47 |
@@ -21,14 +21,14 @@ |
||
21 | 21 | public function __construct($auth) |
22 | 22 | { |
23 | 23 | //authenticate instance |
24 | - $this->auth=$auth; |
|
24 | + $this->auth = $auth; |
|
25 | 25 | |
26 | 26 | // for the builder, we get the namespace value from the auth object. |
27 | 27 | // this namespace will take us to the query builder application. |
28 | - $driverBuilder=$this->auth->getDriverBuilderNamespace(); |
|
28 | + $driverBuilder = $this->auth->getDriverBuilderNamespace(); |
|
29 | 29 | |
30 | 30 | // we get the instance value of |
31 | 31 | // the imported builder object. |
32 | - $this->driverBuilderInstance=new $driverBuilder($auth); |
|
32 | + $this->driverBuilderInstance = new $driverBuilder($auth); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | \ No newline at end of file |