Test Setup Failed
Push — master ( 26eaf4...d9069c )
by Php Easy Api
04:08
created
src/resta/Router/RouteProvider.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
     private function getCallBindController()
40 40
     {
41 41
         //we finally process the method of the class invoked by the user as a process and prepare it for the response
42
-        return app()->resolve(RouteWatch::class)->watch(function(){
42
+        return app()->resolve(RouteWatch::class)->watch(function() {
43 43
             
44 44
             // if the method in the instance object exists,
45 45
             // this method is executed to produce the output.
46
-            if(method_exists($this->app['instanceController'],$this->app['method'])){
47
-                return DIContainerManager::callBind([$this->app['instanceController'],$this->app['method']],
46
+            if (method_exists($this->app['instanceController'], $this->app['method'])) {
47
+                return DIContainerManager::callBind([$this->app['instanceController'], $this->app['method']],
48 48
                     $this->app->applicationProviderBinding($this->app));
49 49
             }
50 50
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function handle()
65 65
     {
66
-        $this->app->register('routerResult',$this->callController());
66
+        $this->app->register('routerResult', $this->callController());
67 67
 
68 68
         //we call our services as controller
69 69
         return $this->app['routerResult'];
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
         $namespace = $this->getControllerNamespace();
81 81
 
82 82
         //utils make bind via dependency injection named as service container
83
-        $this->app->register('serviceConf',$this->app['fileSystem']->callFile(StaticPathModel::getServiceConf()));
84
-        $this->app->register('instanceController',$this->app->resolve($namespace));
83
+        $this->app->register('serviceConf', $this->app['fileSystem']->callFile(StaticPathModel::getServiceConf()));
84
+        $this->app->register('instanceController', $this->app->resolve($namespace));
85 85
     }
86 86
 
87 87
     /**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
         // based on the serviceConf variable,
100 100
         // we are doing parameter bindings in the method context in the routeParameters array key.
101
-        $this->app->register('serviceConf','routeParameters',[$method=>$parameters]);
101
+        $this->app->register('serviceConf', 'routeParameters', [$method=>$parameters]);
102 102
 
103 103
     }
104 104
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function setMethodNameViaDefine($methodName)
112 112
     {
113
-        define('methodName',strtolower($methodName));
113
+        define('methodName', strtolower($methodName));
114 114
     }
115 115
 
116 116
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $fromRoutes = Route::getRouteResolve();
142 142
         $method = $fromRoutes['method'] ?? $method;
143 143
 
144
-        $this->app->register('method',$method);
144
+        $this->app->register('method', $method);
145 145
         $this->app->register('routeParameters', $this->routeParametersAssign($this->resolveMethod($method)));
146 146
 
147 147
     }
Please login to merge, or discard this patch.
src/resta/Router/CheckEndpointForAutoService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/resta/Router/RouteAccessiblePropertyTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
src/resta/Router/RouteWatch.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,17 +12,17 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/resta/Router/Route.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -203,8 +203,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
      * @param $urlRoute
44 44
      * @return int|string
45 45
      */
46
-    private static function checkArrayEqual($patterns,$urlRoute)
46
+    private 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
         }
@@ -66,38 +66,38 @@  discard block
 block discarded – undo
66 66
      * @param $urlMethod
67 67
      * @return array
68 68
      */
69
-    private static function matchingUrlMethod($patterns,$urlMethod)
69
+    private static function matchingUrlMethod($patterns, $urlMethod)
70 70
     {
71
-        if(isset($urlMethod[0])){
71
+        if (isset($urlMethod[0])) {
72 72
 
73 73
             $list = [];
74 74
 
75
-            foreach ($patterns as $key=>$pattern){
75
+            foreach ($patterns as $key=>$pattern) {
76 76
 
77 77
                 // if the initial value of the pattern data is present
78 78
                 // and the first value from urlmethod does not match
79 79
                 // and does not match the custom regex variable,
80 80
                 // we empty the contents of the data.
81
-                if(isset($pattern[0])){
82
-                    if($pattern[0] !== $urlMethod[0] && !self::isMatchVaribleRegexPattern($pattern[0])){
81
+                if (isset($pattern[0])) {
82
+                    if ($pattern[0]!==$urlMethod[0] && !self::isMatchVaribleRegexPattern($pattern[0])) {
83 83
                         $list[$key] = [];
84 84
                     }
85 85
                 }
86 86
 
87 87
                 // if the contents of the directory are not normally emptied,
88 88
                 // we continue to save the list according to keyin status.
89
-                if(!isset($list[$key])){
89
+                if (!isset($list[$key])) {
90 90
                     $list[$key] = $pattern;
91 91
                 }
92 92
 
93 93
                 // This is very important.
94 94
                 // Route matches can be variable-based or static string-based.
95 95
                 // In this case, we remove the other matches based on the static string match.
96
-                if(isset($pattern[0]) && $pattern[0]==$urlMethod[0]){
96
+                if (isset($pattern[0]) && $pattern[0]==$urlMethod[0]) {
97 97
 
98 98
                     // static matches will not be deleted retrospectively.
99 99
                     // this condition will check this.
100
-                    if(isset($list[$key-1],$list[$key-1][0]) && $list[$key-1][0]!==$urlMethod[0]){
100
+                    if (isset($list[$key-1], $list[$key-1][0]) && $list[$key-1][0]!==$urlMethod[0]) {
101 101
                         unset($list[$key-1]);
102 102
                     }
103 103
 
@@ -120,53 +120,53 @@  discard block
 block discarded – undo
120 120
     {
121 121
         $routes = self::getRoutes();
122 122
 
123
-        if(!isset($routes['pattern'])){
123
+        if (!isset($routes['pattern'])) {
124 124
             return [];
125 125
         }
126 126
 
127 127
         $patterns = $routes['pattern'];
128
-        $urlRoute = array_filter(route(),'strlen');
128
+        $urlRoute = array_filter(route(), 'strlen');
129 129
 
130 130
         $patternList = [];
131 131
 
132
-        foreach($routes['data'] as $patternKey=>$routeData){
133
-            if($routeData['http']==httpMethod()){
134
-                $patternList[$patternKey]=$patterns[$patternKey];
132
+        foreach ($routes['data'] as $patternKey=>$routeData) {
133
+            if ($routeData['http']==httpMethod()) {
134
+                $patternList[$patternKey] = $patterns[$patternKey];
135 135
             }
136 136
         }
137 137
 
138
-        $patternList = self::matchingUrlMethod($patternList,$urlRoute);
138
+        $patternList = self::matchingUrlMethod($patternList, $urlRoute);
139 139
 
140
-        foreach ($patternList as $key=>$pattern){
140
+        foreach ($patternList as $key=>$pattern) {
141 141
 
142
-            $pattern = array_filter($pattern,'strlen');
143
-            $diff = Arr::arrayDiffKey($pattern,$urlRoute);
142
+            $pattern = array_filter($pattern, 'strlen');
143
+            $diff = Arr::arrayDiffKey($pattern, $urlRoute);
144 144
 
145
-            if($diff){
145
+            if ($diff) {
146 146
 
147 147
                 $matches = true;
148 148
 
149
-                foreach ($pattern as $patternKey=>$patternValue){
150
-                    if(!self::isMatchVaribleRegexPattern($patternValue)){
151
-                        if($patternValue!==$urlRoute[$patternKey]){
149
+                foreach ($pattern as $patternKey=>$patternValue) {
150
+                    if (!self::isMatchVaribleRegexPattern($patternValue)) {
151
+                        if ($patternValue!==$urlRoute[$patternKey]) {
152 152
                             $matches = false;
153 153
                         }
154 154
                     }
155 155
                 }
156 156
 
157
-                if($matches){
157
+                if ($matches) {
158 158
 
159
-                    $isArrayEqual = self::checkArrayEqual($patternList,$urlRoute);
159
+                    $isArrayEqual = self::checkArrayEqual($patternList, $urlRoute);
160 160
 
161
-                    if($isArrayEqual===null){
161
+                    if ($isArrayEqual===null) {
162 162
                         return $key;
163 163
                     }
164 164
                     return $isArrayEqual;
165 165
                 }
166 166
             }
167 167
 
168
-            if(count($pattern)-1 == count(route())){
169
-                if(preg_match('@\{[a-z]+\?\}@is',end($pattern))){
168
+            if (count($pattern)-1==count(route())) {
169
+                if (preg_match('@\{[a-z]+\?\}@is', end($pattern))) {
170 170
                     return $key;
171 171
                 }
172 172
             }
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
         $patternResolve = self::getPatternResolve();
187 187
 
188 188
         //if routes data is available in pattern resolve.
189
-        if(isset($routes['data'][$patternResolve])){
189
+        if (isset($routes['data'][$patternResolve])) {
190 190
 
191 191
             // if the incoming http value is
192 192
             // the same as the real request method, the data is processed.
193
-            if($routes['data'][$patternResolve]['http'] == strtolower(httpMethod)){
193
+            if ($routes['data'][$patternResolve]['http']==strtolower(httpMethod)) {
194 194
 
195 195
                 // we are set the solved pattern to a variable.
196 196
                 $resolve = $routes['data'][$patternResolve];
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     {
216 216
         // we will record the path data for the route.
217 217
         // We set the routeMapper variables and the route path.
218
-        self::setPath(function(){
218
+        self::setPath(function() {
219 219
 
220 220
             // we are sending
221 221
             // the controller and routes.php path.
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
         // in the paths data,
229 229
         // we run the route mapper values ​​and the route files one by one.
230
-        foreach (self::$paths as $mapper=>$controller){
230
+        foreach (self::$paths as $mapper=>$controller) {
231 231
             core()->fileSystem->callFile($mapper);
232 232
         }
233 233
     }
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     {
242 242
         $routeDefinitor = call_user_func($callback);
243 243
 
244
-        if(isset($routeDefinitor['controllerPath']) && isset($routeDefinitor['routePath'])){
244
+        if (isset($routeDefinitor['controllerPath']) && isset($routeDefinitor['routePath'])) {
245 245
 
246 246
             //the route paths to be saved to the mappers static property.
247 247
             static::$mappers['routePaths'][] = $routeDefinitor['routePath'];
@@ -249,22 +249,22 @@  discard block
 block discarded – undo
249 249
 
250 250
             // if there is endpoint,
251 251
             // then only that endpoint is transferred into the path
252
-            if(defined('endpoint')){
252
+            if (defined('endpoint')) {
253 253
 
254 254
                 $routeName      = endpoint.'Route.php';
255 255
                 $routeMapper    = $routeDefinitor['routePath'].''.DIRECTORY_SEPARATOR.''.$routeName;
256 256
 
257
-                if(file_exists($routeMapper) && !isset(static::$paths[$routeMapper])){
257
+                if (file_exists($routeMapper) && !isset(static::$paths[$routeMapper])) {
258 258
                     static::$paths[$routeMapper] = $routeDefinitor['controllerPath'];
259 259
                 }
260 260
             }
261
-            else{
261
+            else {
262 262
 
263 263
                 // if there is no endpoint,
264 264
                 // all files in the path of the route are transferred to path.
265 265
                 $allFilesInThatRoutePath = Utils::glob($routeDefinitor['routePath']);
266 266
 
267
-                foreach ($allFilesInThatRoutePath as $item){
267
+                foreach ($allFilesInThatRoutePath as $item) {
268 268
                     static::$paths[$item] = $routeDefinitor['controllerPath'];
269 269
                 }
270 270
             }
@@ -278,13 +278,13 @@  discard block
 block discarded – undo
278 278
      * @param $function
279 279
      * @param null $controller
280 280
      */
281
-    public static function setRoute($params,$function,$controller=null)
281
+    public static function setRoute($params, $function, $controller = null)
282 282
     {
283
-        [$pattern,$route]   = $params;
284
-        [$class,$method]    = explode("@",$route);
283
+        [$pattern, $route]   = $params;
284
+        [$class, $method]    = explode("@", $route);
285 285
 
286 286
         $patternList = array_values(
287
-            array_filter(explode("/",$pattern),'strlen')
287
+            array_filter(explode("/", $pattern), 'strlen')
288 288
         );
289 289
 
290 290
         static::$routes['pattern'][] = $patternList;
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
             'http'          => $function,
295 295
             'controller'    => $controller,
296 296
             'namespace'     => static::$namespace,
297
-            'endpoint'      => strtolower(str_replace(StaticPathList::$controllerBundleName,'',static::$namespace))
297
+            'endpoint'      => strtolower(str_replace(StaticPathList::$controllerBundleName, '', static::$namespace))
298 298
         ];
299 299
     }
300 300
 
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
      * @param null $value
305 305
      * @return bool
306 306
      */
307
-    public static function isMatchVaribleRegexPattern($value=null)
307
+    public static function isMatchVaribleRegexPattern($value = null)
308 308
     {
309 309
         // determines if the variable that can be used
310 310
         // in the route file meets the regex rule.
311
-        return (preg_match('@\{(.*?)\}@is',$value)) ? true : false;
311
+        return (preg_match('@\{(.*?)\}@is', $value)) ? true : false;
312 312
     }
313 313
 }
314 314
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Router/KernelRouterProcess.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/resta/Router/RouteHttpManager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/resta/Authenticate/AuthenticateContract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/resta/Authenticate/Resource/AuthLoginManager.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,20 +12,20 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.