Test Failed
Push — master ( 169a53...e99e0c )
by Php Easy Api
05:00
created
src/resta/Router/Route.php 1 patch
Spacing   +39 added lines, -39 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
-    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
         }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public static function getCallingRoute()
68 68
     {
69
-        if(app()->has('routeResolvedData')){
69
+        if (app()->has('routeResolvedData')) {
70 70
             return app()->get('routeResolvedData');
71 71
         }
72 72
         
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $route = self::getRouteResolve();
84 84
 
85
-        if(isset($route['class'])){
85
+        if (isset($route['class'])) {
86 86
             return $route['class'];
87 87
         }
88 88
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         $route = self::getRouteResolve();
100 100
 
101
-        if(isset($route['method'])){
101
+        if (isset($route['method'])) {
102 102
             return $route['method'];
103 103
         }
104 104
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $route = self::getRouteResolve();
116 116
 
117
-        if(isset($route['controller'],$route['namespace'])){
117
+        if (isset($route['controller'], $route['namespace'])) {
118 118
             return $route['controller'].'/'.$route['namespace'];
119 119
         }
120 120
 
@@ -131,17 +131,17 @@  discard block
 block discarded – undo
131 131
         // get routes data and the resolving pattern
132 132
         // Both are interrelated.
133 133
         $routes = self::getRoutes();
134
-        $patternResolve = app()->resolve(RouteMatching::class,['route'=>new self()])->getPatternResolve();
134
+        $patternResolve = app()->resolve(RouteMatching::class, ['route'=>new self()])->getPatternResolve();
135 135
 
136 136
         // we set the route variables for the route assistant.
137 137
         self::updateRouteParameters($patternResolve);
138 138
 
139 139
         //if routes data is available in pattern resolve.
140
-        if(isset($routes['data'][$patternResolve])){
140
+        if (isset($routes['data'][$patternResolve])) {
141 141
 
142 142
             // if the incoming http value is
143 143
             // the same as the real request method, the data is processed.
144
-            if($routes['data'][$patternResolve]['http'] == strtolower(httpMethod)){
144
+            if ($routes['data'][$patternResolve]['http']==strtolower(httpMethod)) {
145 145
 
146 146
                 // we are set the solved pattern to a variable.
147 147
                 $resolve = $routes['data'][$patternResolve];
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                     'http'          => httpMethod(),
155 155
                 ];
156 156
 
157
-                app()->register('routeResolvedData',$routeResolvedData);
157
+                app()->register('routeResolvedData', $routeResolvedData);
158 158
 
159 159
                 return $routeResolvedData;
160 160
             }
@@ -173,22 +173,22 @@  discard block
 block discarded – undo
173 173
     {
174 174
         $list = [];
175 175
 
176
-        if(isset(static::$routes['pattern'][$patternResolvedKey])){
176
+        if (isset(static::$routes['pattern'][$patternResolvedKey])) {
177 177
 
178 178
             $routeParameters = static::$routes['pattern'][$patternResolvedKey];
179 179
             $route = route();
180 180
 
181
-            foreach($routeParameters as $key=>$param){
181
+            foreach ($routeParameters as $key=>$param) {
182 182
 
183
-                $param = Str::replaceWordArray(['{','}','?'],'',$param);
183
+                $param = Str::replaceWordArray(['{', '}', '?'], '', $param);
184 184
 
185
-                if(isset($route[$key])){
185
+                if (isset($route[$key])) {
186 186
                     $list[$param] = $route[$key];
187 187
                 }
188 188
             }
189 189
         }
190 190
 
191
-        app()->register('routeParams',$list);
191
+        app()->register('routeParams', $list);
192 192
     }
193 193
 
194 194
     /**
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
      *
197 197
      * @param bool $endpoint
198 198
      */
199
-    public function handle($endpoint=true)
199
+    public function handle($endpoint = true)
200 200
     {
201 201
         // we will record the path data for the route.
202 202
         // We set the routeMapper variables and the route path.
203
-        self::setPath(function(){
203
+        self::setPath(function() {
204 204
 
205 205
             // we are sending
206 206
             // the controller and routes.php path.
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
         // in the paths data,
214 214
         // we run the route mapper values ​​and the route files one by one.
215
-        foreach (self::$paths as $mapper=>$controller){
215
+        foreach (self::$paths as $mapper=>$controller) {
216 216
             core()->fileSystem->callFile($mapper);
217 217
         }
218 218
     }
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
      * @param callable $callback
224 224
      * @param bool $endpoint
225 225
      */
226
-    public static function setPath(callable $callback,$endpoint=true)
226
+    public static function setPath(callable $callback, $endpoint = true)
227 227
     {
228 228
         $routeDefinitor = call_user_func($callback);
229 229
 
230
-        if(isset($routeDefinitor['controllerPath']) && isset($routeDefinitor['routePath'])){
230
+        if (isset($routeDefinitor['controllerPath']) && isset($routeDefinitor['routePath'])) {
231 231
 
232 232
             //the route paths to be saved to the mappers static property.
233 233
             static::$mappers['routePaths'][] = $routeDefinitor['routePath'];
@@ -235,22 +235,22 @@  discard block
 block discarded – undo
235 235
 
236 236
             // if there is endpoint,
237 237
             // then only that endpoint is transferred into the path
238
-            if(defined('endpoint') && $endpoint){
238
+            if (defined('endpoint') && $endpoint) {
239 239
 
240 240
                 $routeName      = endpoint.'Route.php';
241 241
                 $routeMapper    = $routeDefinitor['routePath'].''.DIRECTORY_SEPARATOR.''.$routeName;
242 242
 
243
-                if(file_exists($routeMapper) && !isset(static::$paths[$routeMapper])){
243
+                if (file_exists($routeMapper) && !isset(static::$paths[$routeMapper])) {
244 244
                     static::$paths[$routeMapper] = $routeDefinitor['controllerPath'];
245 245
                 }
246 246
             }
247
-            else{
247
+            else {
248 248
 
249 249
                 // if there is no endpoint,
250 250
                 // all files in the path of the route are transferred to path.
251 251
                 $allFilesInThatRoutePath = Utils::glob($routeDefinitor['routePath']);
252 252
 
253
-                foreach ($allFilesInThatRoutePath as $item){
253
+                foreach ($allFilesInThatRoutePath as $item) {
254 254
                     static::$paths[$item] = $routeDefinitor['controllerPath'];
255 255
                 }
256 256
             }
@@ -264,13 +264,13 @@  discard block
 block discarded – undo
264 264
      * @param $function
265 265
      * @param null $controller
266 266
      */
267
-    public static function setRoute($params,$function,$controller=null)
267
+    public static function setRoute($params, $function, $controller = null)
268 268
     {
269
-        [$pattern,$route]   = $params;
270
-        [$class,$method]    = explode("@",$route);
269
+        [$pattern, $route]   = $params;
270
+        [$class, $method]    = explode("@", $route);
271 271
 
272 272
         $patternList = array_values(
273
-            array_filter(explode("/",$pattern),'strlen')
273
+            array_filter(explode("/", $pattern), 'strlen')
274 274
         );
275 275
 
276 276
         static::$routes['pattern'][] = $patternList;
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             'http'          => $function,
281 281
             'controller'    => $controller,
282 282
             'namespace'     => static::$namespace,
283
-            'endpoint'      => strtolower(str_replace(StaticPathList::$controllerBundleName,'',static::$namespace))
283
+            'endpoint'      => strtolower(str_replace(StaticPathList::$controllerBundleName, '', static::$namespace))
284 284
         ];
285 285
     }
286 286
 
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
      * @param null $value
291 291
      * @return bool
292 292
      */
293
-    public static function isMatchVaribleRegexPattern($value=null)
293
+    public static function isMatchVaribleRegexPattern($value = null)
294 294
     {
295 295
         // determines if the variable that can be used
296 296
         // in the route file meets the regex rule.
297
-        return (preg_match('@\{(.*?)\}@is',$value)) ? true : false;
297
+        return (preg_match('@\{(.*?)\}@is', $value)) ? true : false;
298 298
     }
299 299
 
300 300
 
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
      * @param null $value
305 305
      * @return bool
306 306
      */
307
-    public static function isOptionalVaribleRegexPattern($value=null)
307
+    public static function isOptionalVaribleRegexPattern($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('@\{[a-z]+\?\}@is',$value) ? true : false;
311
+        return preg_match('@\{[a-z]+\?\}@is', $value) ? true : false;
312 312
     }
313 313
 
314 314
     /**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         $application->loadIfNotExistBoot(['middleware']);
334 334
         $middlewareProvider = $application['middleware'];
335 335
 
336
-        foreach($routeData as $key=>$data) {
336
+        foreach ($routeData as $key=>$data) {
337 337
 
338 338
             $middlewareProvider->setKeyOdds('endpoint', $data['endpoint']);
339 339
             $middlewareProvider->setKeyOdds('method', $data['method']);
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             $afterMiddleware = $middlewareProvider->getShow();
347 347
 
348 348
             $endpoint = $data['endpoint'];
349
-            $controllerNamespace = Utils::getNamespace($data['controller'] . '/' . $data['namespace'] . '/' . $data['class']);
349
+            $controllerNamespace = Utils::getNamespace($data['controller'].'/'.$data['namespace'].'/'.$data['class']);
350 350
 
351 351
             $methodDocument = app()['reflection']($controllerNamespace)->reflectionMethodParams($data['method'])->document;
352 352
 
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
                 }
359 359
             }
360 360
 
361
-            $mappings[$key]['endpoint'] = $endpoint . '/' . implode("/", $routePattern[$key]);
361
+            $mappings[$key]['endpoint'] = $endpoint.'/'.implode("/", $routePattern[$key]);
362 362
             $mappings[$key]['http'] = $data['http'];
363 363
             $mappings[$key]['definition'] = $methodDefinition;
364
-            $mappings[$key]['before'] = implode(",",$beforeMiddleware);
365
-            $mappings[$key]['after'] = implode(",",$afterMiddleware);
364
+            $mappings[$key]['before'] = implode(",", $beforeMiddleware);
365
+            $mappings[$key]['after'] = implode(",", $afterMiddleware);
366 366
             $mappings[$key]['doc'] = 'not available';
367 367
 
368 368
         }
Please login to merge, or discard this patch.
src/resta/Response/ResponseProvider.php 1 patch
Spacing   +11 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
         //the auto service to be called.
29 29
         return ClosureDispatcher::bind($controllerInstance)->call(function() use($controllerInstance){
30 30
 
31
-            if(property_exists($controllerInstance,'response')){
31
+            if (property_exists($controllerInstance, 'response')) {
32 32
                 return $controllerInstance->response;
33 33
             }
34 34
 
35 35
             // if the client wishes,
36 36
             // data can be returned in the supported format.
37
-            if(app()->has('clientResponseType')){
37
+            if (app()->has('clientResponseType')) {
38 38
                 return app()->get('clientResponseType');
39 39
             }
40 40
 
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
      * @param bool $return
50 50
      * @return void
51 51
      */
52
-    protected function fireEvent($event=null,$return=false)
52
+    protected function fireEvent($event = null, $return = false)
53 53
     {
54 54
         // if an array of response-events is registered
55 55
         // in the container system, the event will fire.
56
-        if($this->app->has('response-event.'.$event)){
56
+        if ($this->app->has('response-event.'.$event)) {
57 57
             $event = $this->app->get('response-event.'.$event);
58 58
 
59 59
             // the event to be fired must be
60 60
             // a closure instance.
61
-            if($event instanceof Closure){
61
+            if ($event instanceof Closure) {
62 62
                 $eventResolved = $event($this->app);
63 63
 
64
-                if($return){
64
+                if ($return) {
65 65
                     return $eventResolved;
66 66
                 }
67 67
             }
@@ -100,8 +100,7 @@  discard block
 block discarded – undo
100 100
     {
101 101
         //we get the response type by checking the instanceController object from the router.
102 102
         //Each type of response is in the base class in project directory.
103
-        return ($this->getControllerInstance()===null) ? core()->responseType :
104
-            $this->appResponseType();
103
+        return ($this->getControllerInstance()===null) ? core()->responseType : $this->appResponseType();
105 104
     }
106 105
 
107 106
     /**
@@ -112,13 +111,13 @@  discard block
 block discarded – undo
112 111
     public function handle()
113 112
     {
114 113
         //definition for singleton instance
115
-        define ('responseApp',true);
114
+        define('responseApp', true);
116 115
 
117 116
         //get out putter for response
118 117
         $formatter = $this->formatter();
119 118
 
120 119
         //if out putter is not null
121
-        if(Utils::isNamespaceExists($formatter)){
120
+        if (Utils::isNamespaceExists($formatter)) {
122 121
 
123 122
             //fire event before response output
124 123
             $this->fireEvent('before');
@@ -133,7 +132,7 @@  discard block
 block discarded – undo
133 132
             // and run the handle method.
134 133
             $result = app()->resolve($formatter)->{$this->getResponseKind()}($outPutter);
135 134
 
136
-            $this->app->register('result',$result);
135
+            $this->app->register('result', $result);
137 136
         }
138 137
     }
139 138
 
@@ -143,7 +142,7 @@  discard block
 block discarded – undo
143 142
      * @param array $data
144 143
      * @return array
145 144
      */
146
-    public function outputFormatter($data=array(),$outputter='json')
145
+    public function outputFormatter($data = array(), $outputter = 'json')
147 146
     {
148 147
         $dataCapsule = config('response.data');
149 148
 
Please login to merge, or discard this patch.
src/resta/Response/ResponseOutManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      */
16 16
     public function __construct($app)
17 17
     {
18
-        $this->app=$app;
18
+        $this->app = $app;
19 19
     }
20 20
 
21 21
     /**
Please login to merge, or discard this patch.
src/resta/Response/ResponseOutput.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
      */
19 19
     private function dataIncludedForPrinter($printer)
20 20
     {
21
-        if(isset(core()->controllerWatch)){
21
+        if (isset(core()->controllerWatch)) {
22 22
 
23 23
             $watch = core()->controllerWatch;
24
-            return array_merge($printer,['watch'=>['memory'=>$watch['memory']]]);
24
+            return array_merge($printer, ['watch'=>['memory'=>$watch['memory']]]);
25 25
         }
26 26
 
27 27
         //return printer
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected function getOutPutter()
43 43
     {
44
-        $output = is_array($eventOutput = $this->fireEvent('output',true))
44
+        $output = is_array($eventOutput = $this->fireEvent('output', true))
45 45
             ? $eventOutput
46 46
             : $this->printer($this->getRouter());
47 47
 
48
-        app()->register('output',$output);
48
+        app()->register('output', $output);
49 49
 
50 50
         return $output;
51 51
     }
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
      * @param array $data
55 55
      * @return array
56 56
      */
57
-    private function hateoasCapsule($data=array())
57
+    private function hateoasCapsule($data = array())
58 58
     {
59
-        return (config('app.hateoas')) ? array_merge($data,config('hateoas')) : $data;
59
+        return (config('app.hateoas')) ? array_merge($data, config('hateoas')) : $data;
60 60
     }
61 61
 
62 62
     /**
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
      * @param callable $callback
73 73
      * @return mixed
74 74
      */
75
-    private function noInExceptionHateoas($output,callable $callback)
75
+    private function noInExceptionHateoas($output, callable $callback)
76 76
     {
77
-        if(isset($output['success']) && false===$output['success']){
77
+        if (isset($output['success']) && false===$output['success']) {
78 78
             return $output;
79 79
         }
80 80
         return call_user_func($callback);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     {
102 102
         //if the system throws an exception,
103 103
         //we subtract the hateoas extension from the output value.
104
-        $this->printer = $this->noInExceptionHateoas($output,function() use ($output){
104
+        $this->printer = $this->noInExceptionHateoas($output, function() use ($output){
105 105
 
106 106
             return array_merge(
107 107
                 $this->metaAdd(),
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 
116 116
         // If the log feature is available on the kernel,
117 117
         // we run the logger process.
118
-        if(isset(core()->log)){
118
+        if (isset(core()->log)) {
119 119
 
120 120
             // we can run logging after checking
121 121
             // the configuration for the logger process in the LoggerService class
122 122
             // so that,If logging is not allowed in the main configuration file, we will not log.
123
-            return core()->loggerService->checkLoggerConfiguration($this->printer,function($printer){
123
+            return core()->loggerService->checkLoggerConfiguration($this->printer, function($printer) {
124 124
                 return $printer;
125 125
             });
126 126
         }
Please login to merge, or discard this patch.
src/resta/Console/Source/Project/Project.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     /**
15 15
      * @var $type
16 16
      */
17
-    public $type='project';
17
+    public $type = 'project';
18 18
 
19 19
     /**
20 20
      * @var array
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     /**
32 32
      * @var $commandRule
33 33
      */
34
-    public $commandRule=[];
34
+    public $commandRule = [];
35 35
 
36 36
     /**
37 37
      * @method create
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
         $this->directory['projectDir']          = $this->projectPath();
47 47
         $this->argument['exceptionNamespace']   = app()->namespace()->exception();
48 48
         $this->argument['resourcePath']         = app()->path()->appResourche();
49
-        $this->argument['testNamespace']             = app()->namespace()->tests();
49
+        $this->argument['testNamespace'] = app()->namespace()->tests();
50 50
 
51
-        $recursiveDefaultDirectory = explode("\\",$this->argument['project']);
51
+        $recursiveDefaultDirectory = explode("\\", $this->argument['project']);
52 52
         $this->argument['applicationName'] = pos($recursiveDefaultDirectory);
53 53
         $recursiveDefaultDirectory[] = 'V1';
54 54
         $recursiveDefaultDirectoryList = [];
55 55
 
56
-        foreach (array_slice($recursiveDefaultDirectory,1) as $defaultDirectory){
56
+        foreach (array_slice($recursiveDefaultDirectory, 1) as $defaultDirectory) {
57 57
 
58
-            $recursiveDefaultDirectoryList[]=$defaultDirectory;
59
-            $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/",$recursiveDefaultDirectoryList);
58
+            $recursiveDefaultDirectoryList[] = $defaultDirectory;
59
+            $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/", $recursiveDefaultDirectoryList);
60 60
         }
61 61
 
62 62
         //$this->directory['optionalDir'] = $this->optional();
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         //$this->directory['sourceDir']               = $this->sourceDir();
83 83
         //$this->directory['sourceSupportDir']        = $this->sourceSupportDir();
84 84
         //$this->directory['sourceSupportTraitDir']   = $this->sourceSupportDir().'/Traits';
85
-        $this->directory['exceptionDir']            = app()->path()->exception();
85
+        $this->directory['exceptionDir'] = app()->path()->exception();
86 86
 
87 87
         //set project directory
88 88
         $this->file->makeDirectory($this);
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
         $this->touch['kernel/exception']            = $this->provider().'/ExceptionServiceProvider.php';
100 100
         $this->touch['kernel/response']             = $this->provider().'/ResponseServiceProvider.php';
101 101
         $this->touch['kernel/entity']               = $this->provider().'/EntityServiceProvider.php';
102
-        $this->touch['kernel/cache']               = $this->provider().'/CacheServiceProvider.php';
102
+        $this->touch['kernel/cache'] = $this->provider().'/CacheServiceProvider.php';
103 103
         $this->touch['kernel/authenticate']         = $this->provider().'/AuthenticateServiceProvider.php';
104 104
         $this->touch['kernel/role']                 = $this->provider().'/RoleServiceProvider.php';
105 105
         $this->touch['kernel/track']                = $this->provider().'/TrackServiceProvider.php';
106
-        $this->touch['test/testcase']              = $this->test().'/TestCase.php';
106
+        $this->touch['test/testcase'] = $this->test().'/TestCase.php';
107 107
         $this->touch['kernel/consoleevent']         = $this->provider().'/ConsoleEventServiceProvider.php';
108 108
         $this->touch['middleware/authenticate']     = $this->middleware().'/Authenticate.php';
109 109
         $this->touch['middleware/ratelimit']        = $this->middleware().'/RateLimit.php';
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         $this->touch['app/gitignore']               = $this->projectPath().'/.gitignore';
145 145
         $this->touch['app/composer']                = $this->projectPath().'/composer.json';
146 146
         $this->touch['test/index']                  = $this->storage().'/index.html';
147
-        $this->touch['exception/authenticate']      = $this->directory['exceptionDir'] .'/AuthenticateException.php';
147
+        $this->touch['exception/authenticate']      = $this->directory['exceptionDir'].'/AuthenticateException.php';
148 148
 
149 149
         //set project touch
150 150
         $this->file->touch($this);
Please login to merge, or discard this patch.