Test Setup Failed
Push — master ( 80630f...0e2875 )
by Php Easy Api
05:19
created
src/resta/Foundation/ApplicationHelpers.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     function applicationKey()
50 50
     {
51
-        if(property_exists($kernel=app()->kernel(),'applicationKey')){
51
+        if (property_exists($kernel = app()->kernel(), 'applicationKey')) {
52 52
             return $kernel->applicationKey;
53 53
         }
54 54
         return null;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     function bundleName()
83 83
     {
84
-        if(defined('endpoint')){
84
+        if (defined('endpoint')) {
85 85
 
86 86
             return endpoint.''.StaticPathList::$controllerBundleName;
87 87
         }
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
      * @param null $default
97 97
      * @return mixed|null
98 98
      */
99
-    function config($config=null,$default=null)
99
+    function config($config = null, $default = null)
100 100
     {
101 101
         $configResult = app()->config($config);
102 102
 
103
-        if($configResult === null && $default!==null){
103
+        if ($configResult===null && $default!==null) {
104 104
             return $default;
105 105
         }
106 106
 
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
      * @param $bind array
116 116
      * @return mixed
117 117
      */
118
-    function container($class,$bind=array())
118
+    function container($class, $bind = array())
119 119
     {
120
-        return app()->singleton()->appClass->container(appInstance(),$class,$bind);
120
+        return app()->singleton()->appClass->container(appInstance(), $class, $bind);
121 121
     }
122 122
 }
123 123
 
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
      * @param array $params
178 178
      * @return ExceptionContracts
179 179
      */
180
-    function exception($name=null,$params=array())
180
+    function exception($name = null, $params = array())
181 181
     {
182
-        $exceptionManager=ExceptionManager::class;
183
-        return app()->resolve($exceptionManager,['name'=>$name,'params'=>$params]);
182
+        $exceptionManager = ExceptionManager::class;
183
+        return app()->resolve($exceptionManager, ['name'=>$name, 'params'=>$params]);
184 184
     }
185 185
 }
186 186
 
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
      * @param null $locale
191 191
      * @return Generator
192 192
      */
193
-    function faker($locale=null)
193
+    function faker($locale = null)
194 194
     {
195
-        if($locale===null){
196
-            $faker=Factory::create();
195
+        if ($locale===null) {
196
+            $faker = Factory::create();
197 197
         }
198
-        else{
199
-            $faker=Factory::create($locale);
198
+        else {
199
+            $faker = Factory::create($locale);
200 200
         }
201 201
 
202 202
         return $faker;
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 
208 208
     function fingerPrint()
209 209
     {
210
-        return md5(sha1(implode("|",[
211
-            request()->getClientIp(),$_SERVER['HTTP_USER_AGENT'],applicationKey()
210
+        return md5(sha1(implode("|", [
211
+            request()->getClientIp(), $_SERVER['HTTP_USER_AGENT'], applicationKey()
212 212
         ])));
213 213
     }
214 214
 }
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
      * @param null $default
229 229
      * @return null
230 230
      */
231
-    function get($param=null,$default=null)
231
+    function get($param = null, $default = null)
232 232
     {
233 233
         //symfony request query object
234
-        $get=core()->get;
234
+        $get = core()->get;
235 235
 
236 236
         return ($param===null) ? $get : (isset($get[$param]) ? $get[$param] : $default);
237 237
     }
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
      * @param null $default
245 245
      * @return array|string
246 246
      */
247
-    function headers($param=null,$default=null)
247
+    function headers($param = null, $default = null)
248 248
     {
249
-        $list=[];
249
+        $list = [];
250 250
 
251 251
         //We only get the objects in the list name to match the header objects
252 252
         //that come with the request path to the objects sent by the client
253 253
         foreach (request()->headers->all() as $key=>$value) {
254
-            $list[$key]=$value;
254
+            $list[$key] = $value;
255 255
         }
256 256
 
257 257
         //return header list
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
      * @param $file null
277 277
      * @return LoggerHandler
278 278
      */
279
-    function logger($file=null)
279
+    function logger($file = null)
280 280
     {
281
-        return app()->resolve(LoggerHandler::class,['file'=>$file]);
281
+        return app()->resolve(LoggerHandler::class, ['file'=>$file]);
282 282
     }
283 283
 }
284 284
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      */
301 301
     function response()
302 302
     {
303
-        $object=debug_backtrace()[1]['object'];
303
+        $object = debug_backtrace()[1]['object'];
304 304
         return new ResponseOutManager($object);
305 305
     }
306 306
 }
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
      * @throws \DI\DependencyException
316 316
      * @throws \DI\NotFoundException
317 317
      */
318
-    function resolve($class,$bind=array())
318
+    function resolve($class, $bind = array())
319 319
     {
320
-        return app()->resolve($class,$bind);
320
+        return app()->resolve($class, $bind);
321 321
     }
322 322
 }
323 323
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
      */
329 329
     function policy()
330 330
     {
331
-        $policyPath = implode('/',[
331
+        $policyPath = implode('/', [
332 332
             Route::getRouteControllerNamespace(),
333 333
             'Policy',
334 334
             Route::getRouteControllerClass().'Policy'
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 
337 337
         $policyNamespace = Utils::getNamespace($policyPath);
338 338
 
339
-        if(Utils::isNamespaceExists($policyNamespace)){
339
+        if (Utils::isNamespaceExists($policyNamespace)) {
340 340
             return app()->resolve(Utils::getNamespace($policyPath));
341 341
         }
342 342
 
@@ -351,10 +351,10 @@  discard block
 block discarded – undo
351 351
      * @param $key
352 352
      * @return mixed
353 353
      */
354
-    function route($key=null)
354
+    function route($key = null)
355 355
     {
356
-        if(is_null($key)){
357
-            return array_map(function($route){
356
+        if (is_null($key)) {
357
+            return array_map(function($route) {
358 358
                 return strtolower($route);
359 359
             },app()->singleton()->appClass->route($key));
360 360
         }
@@ -382,10 +382,10 @@  discard block
 block discarded – undo
382 382
      * @param null $default
383 383
      * @return mixed
384 384
      */
385
-    function post($param=null,$default=null)
385
+    function post($param = null, $default = null)
386 386
     {
387 387
         //symfony request query object
388
-        $post=core()->post;
388
+        $post = core()->post;
389 389
 
390 390
         return ($param===null) ? $post : (isset($post[$param]) ? $post[$param] : $default);
391 391
     }
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
      * @param array $select
417 417
      * @return mixed
418 418
      */
419
-    function trans($lang,$select=array())
419
+    function trans($lang, $select = array())
420 420
     {
421
-        return app()->singleton()->appClass->translator($lang,$select);
421
+        return app()->singleton()->appClass->translator($lang, $select);
422 422
     }
423 423
 }
424 424
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Response/ResponseProvider.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
         //the auto service to be called.
28 28
         return ClosureDispatcher::bind($controllerInstance)->call(function() use($controllerInstance){
29 29
 
30
-            if(property_exists($controllerInstance,'response')){
30
+            if (property_exists($controllerInstance, 'response')) {
31 31
                 return $controllerInstance->response;
32 32
             }
33 33
 
34 34
             // if the client wishes,
35 35
             // data can be returned in the supported format.
36
-            if($this->app->has('clientResponseType')){
36
+            if ($this->app->has('clientResponseType')) {
37 37
                 return $this->app->get('clientResponseType');
38 38
             }
39 39
 
@@ -73,8 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         //we get the response type by checking the instanceController object from the router.
75 75
         //Each type of response is in the base class in project directory.
76
-        return ($this->getControllerInstance()===null) ? core()->responseType :
77
-            $this->appResponseType();
76
+        return ($this->getControllerInstance()===null) ? core()->responseType : $this->appResponseType();
78 77
     }
79 78
 
80 79
     /**
@@ -85,19 +84,19 @@  discard block
 block discarded – undo
85 84
     public function handle()
86 85
     {
87 86
         //definition for singleton instance
88
-        define ('responseApp',true);
87
+        define('responseApp', true);
89 88
 
90 89
         //get out putter for response
91 90
         $formatter = $this->formatter();
92 91
 
93 92
         //if out putter is not null
94
-        if(Utils::isNamespaceExists($formatter)){
93
+        if (Utils::isNamespaceExists($formatter)) {
95 94
 
96 95
             //We resolve the response via the service container
97 96
             //and run the handle method.
98 97
             $result = app()->resolve($formatter)->{$this->getResponseKind()}($this->getOutPutter());
99 98
 
100
-            $this->app->register('result',$result);
99
+            $this->app->register('result', $result);
101 100
         }
102 101
     }
103 102
 
@@ -107,7 +106,7 @@  discard block
 block discarded – undo
107 106
      * @param array $data
108 107
      * @return array
109 108
      */
110
-    public function outputFormatter($data=array())
109
+    public function outputFormatter($data = array())
111 110
     {
112 111
         $dataCapsule = config('response.data');
113 112
 
Please login to merge, or discard this patch.