Test Setup Failed
Push — master ( cd364e...e9efe7 )
by Php Easy Api
04:06
created
src/resta/Authenticate/AuthenticateProvider.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
 class AuthenticateProvider extends ConfigProvider implements AuthenticateContract
10 10
 {
11 11
     //get auth response,auth exception,auth token and auth basic
12
-    use AuthenticateResponse,AuthenticateException,AuthenticateToken,AuthenticateBasic;
12
+    use AuthenticateResponse, AuthenticateException, AuthenticateToken, AuthenticateBasic;
13 13
 
14 14
     /**
15 15
      * @var string
16 16
      */
17
-    protected $guard='default';
17
+    protected $guard = 'default';
18 18
 
19 19
     /**
20 20
      * @return bool
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
     {
24 24
         // header to determine whether
25 25
         // the token value is present and return a callback.
26
-        return $this->checkTokenViaHeaders(function($token){
26
+        return $this->checkTokenViaHeaders(function($token) {
27 27
 
28 28
             // we send the user-supplied token value
29 29
             // to the authCheckManager object.
30
-            new AuthCheckManager($this,$token);
30
+            new AuthCheckManager($this, $token);
31 31
 
32 32
             // as a result we send output according to
33 33
             // the boolean value from the checkResult method.
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function guard($guard)
43 43
     {
44
-        $this->guard=$guard;
44
+        $this->guard = $guard;
45 45
 
46 46
         $this->setAuthenticateNeeds();
47 47
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         // we obtain the id value obtained via
57 57
         // authenticate availability with the help of callback object.
58
-        return $this->checkParamsViaAvailability('authId',function($id){
58
+        return $this->checkParamsViaAvailability('authId', function($id) {
59 59
             return $id;
60 60
         });
61 61
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param bool $objectReturn
66 66
      * @return $this|mixed
67 67
      */
68
-    public function login($credentials=null,$objectReturn=false)
68
+    public function login($credentials = null, $objectReturn = false)
69 69
     {
70 70
         // we will determine whether
71 71
         // the http path is correct for this method.
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 
74 74
         // we invoke the login manager and the properties
75 75
         // that this class creates will inform us about user input.
76
-        $loginManager = new AuthLoginManager($credentials,$this);
76
+        $loginManager = new AuthLoginManager($credentials, $this);
77 77
 
78 78
         // if you want to see the entire login manager object directly,
79 79
         // send true to the objectReturn parameter.
80
-        if($objectReturn) return $loginManager;
80
+        if ($objectReturn) return $loginManager;
81 81
 
82 82
         // the login value stored in the params property of the login manager object will return a builder object.
83 83
         // we will return the value of the login state as a boolean using the count method of this builder object.
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 
96 96
         // header to determine whether
97 97
         // the token value is present and return a callback.
98
-        return $this->checkTokenViaHeaders(function($token){
98
+        return $this->checkTokenViaHeaders(function($token) {
99 99
 
100 100
             // we send the user-supplied token value
101 101
             // to the authCheckManager object.
102
-            new AuthLogoutManager($this,$token);
102
+            new AuthLogoutManager($this, $token);
103 103
 
104 104
             // as a result we send output according to
105 105
             // the boolean value from the checkResult method.
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     {
115 115
         // we obtain the token value obtained via
116 116
         // authenticate availability with the help of callback object.
117
-        return $this->checkParamsViaAvailability('authToken',function($token){
117
+        return $this->checkParamsViaAvailability('authToken', function($token) {
118 118
             return $token;
119 119
         });
120 120
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     {
127 127
         // we obtain the user value obtained via
128 128
         // authenticate availability with the help of callback object.
129
-        return $this->checkParamsViaAvailability('auth',function($user){
129
+        return $this->checkParamsViaAvailability('auth', function($user) {
130 130
             return $user;
131 131
         });
132 132
     }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     {
139 139
         // we obtain the data value obtained via
140 140
         // authenticate availability with the help of callback object.
141
-        return $this->checkParamsViaAvailability('data',function($data){
141
+        return $this->checkParamsViaAvailability('data', function($data) {
142 142
             return $data;
143 143
         });
144 144
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,9 @@
 block discarded – undo
77 77
 
78 78
         // if you want to see the entire login manager object directly,
79 79
         // send true to the objectReturn parameter.
80
-        if($objectReturn) return $loginManager;
80
+        if($objectReturn) {
81
+            return $loginManager;
82
+        }
81 83
 
82 84
         // the login value stored in the params property of the login manager object will return a builder object.
83 85
         // we will return the value of the login state as a boolean using the count method of this builder object.
Please login to merge, or discard this patch.
src/resta/Authenticate/AuthenticateBasic.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
     /**
8 8
      * @param callable $callback
9 9
      */
10
-    protected function checkParamsViaAvailability($data,callable $callback)
10
+    protected function checkParamsViaAvailability($data, callable $callback)
11 11
     {
12 12
         // if an authenticate is provided via the existing check method,
13 13
         // then we return the value of the data that we are checking for with callback help.
14
-        if($this->check() && isset($this->params[$data])){
15
-            return call_user_func_array($callback,[$this->params[$data]]);
14
+        if ($this->check() && isset($this->params[$data])) {
15
+            return call_user_func_array($callback, [$this->params[$data]]);
16 16
         }
17 17
 
18 18
         return null;
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
      */
24 24
     protected function checkProcessHttpMethod($type)
25 25
     {
26
-        $getHttp=(array)$this->getHttp();
26
+        $getHttp = (array)$this->getHttp();
27 27
 
28 28
         // we will determine whether
29 29
         // the http path is correct for this method.
30
-        if(isset($getHttp[$type]) and $getHttp[$type]!==httpMethod()){
30
+        if (isset($getHttp[$type]) and $getHttp[$type]!==httpMethod()) {
31 31
             $this->getExceptionForHttp($getHttp[$type]);
32 32
         }
33 33
     }
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
         $headers = headers();
42 42
 
43 43
         //get token key from config
44
-        $tokenKey=$this->getTokenKey();
44
+        $tokenKey = $this->getTokenKey();
45 45
 
46 46
         // if there is a token in the headers,
47 47
         // we return the callback.
48
-        if(isset($headers[$tokenKey])){
49
-            return call_user_func_array($callback,[$headers[$tokenKey][0]]);
48
+        if (isset($headers[$tokenKey])) {
49
+            return call_user_func_array($callback, [$headers[$tokenKey][0]]);
50 50
         }
51 51
 
52 52
         //token false
Please login to merge, or discard this patch.
src/resta/Authenticate/AuthenticateRequest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
      *
14 14
      * @var array $autoInject
15 15
      */
16
-    protected $autoInject=[];
16
+    protected $autoInject = [];
17 17
 
18 18
     /**
19 19
      * The values ​​expected by the server.
20 20
      * @var array
21 21
      */
22
-    protected $expected=[];
22
+    protected $expected = [];
23 23
 
24 24
     /**
25 25
      * mandatory http method.
26 26
      * @var array
27 27
      */
28
-    protected $http=[];
28
+    protected $http = [];
29 29
 
30 30
     /**
31 31
      * AuthenticateRequest constructor.
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
     public function __construct($credentials)
35 35
     {
36 36
         //credentials loop for expected property
37
-        foreach ($credentials as $credential){
38
-            $this->expected[]=$credential;
37
+        foreach ($credentials as $credential) {
38
+            $this->expected[] = $credential;
39 39
         }
40 40
 
41 41
         parent::__construct();
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function credentials($credentials)
48 48
     {
49
-        $credentials=[];
49
+        $credentials = [];
50 50
 
51
-        foreach ($this->inputs as $inputKey=>$inputValue){
51
+        foreach ($this->inputs as $inputKey=>$inputValue) {
52 52
 
53
-            if(in_array($inputKey,$this->expected)){
54
-                $credentials[$inputKey]=$inputValue;
53
+            if (in_array($inputKey, $this->expected)) {
54
+                $credentials[$inputKey] = $inputValue;
55 55
             }
56 56
         }
57 57
 
Please login to merge, or discard this patch.
src/resta/Cache/CacheManager.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,9 @@
 block discarded – undo
123 123
         }
124 124
 
125 125
         //this method may show continuity depending on the macro.
126
-        if(false === $this instanceof $macro) return ;
126
+        if(false === $this instanceof $macro) {
127
+            return ;
128
+        }
127 129
 
128 130
         // retrieve the cache item
129 131
         $cacheItem = $this->cache->getItem($this->name);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function adapter($adapter)
57 57
     {
58
-        if(!is_null($adapter)){
58
+        if (!is_null($adapter)) {
59 59
             $this->adapter = $adapter;
60 60
         }
61 61
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         //name variable is
74 74
         //the name of the cache data set to be created.
75
-        if(!is_null($name)){
75
+        if (!is_null($name)) {
76 76
             $this->name = $name;
77 77
         }
78 78
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     {
90 90
         //Cache data is set at the time.
91 91
         //Data will be valid in this time.
92
-        if(is_numeric($expire)){
92
+        if (is_numeric($expire)) {
93 93
             $this->expire = $expire;
94 94
         }
95 95
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     {
109 109
         // this class has a macro that can be managed by the user.
110 110
         // macros work as an extensible version of the classes.
111
-        $macro = $this->app['macro']->with(config('kernel.macros.cache'),$this,$this->adapter);
111
+        $macro = $this->app['macro']->with(config('kernel.macros.cache'), $this, $this->adapter);
112 112
 
113 113
         //set cache macroable object
114 114
         $this->cache = $macro->{$this->adapter}($callback);
@@ -118,19 +118,19 @@  discard block
 block discarded – undo
118 118
         $backtrace = debug_backtrace()[1];
119 119
 
120 120
         //If name is null, we name it with backtrace.
121
-        if($this->name===null) {
121
+        if ($this->name===null) {
122 122
             $this->name = md5($backtrace['function'].'_'.$backtrace['class']);
123 123
         }
124 124
 
125 125
         //this method may show continuity depending on the macro.
126
-        if(false === $this instanceof $macro) return ;
126
+        if (false===$this instanceof $macro) return;
127 127
 
128 128
         // retrieve the cache item
129 129
         $cacheItem = $this->cache->getItem($this->name);
130 130
 
131 131
         if (!$cacheItem->isHit()) {
132 132
 
133
-            $data=call_user_func($callback);
133
+            $data = call_user_func($callback);
134 134
             $cacheItem->set($data);
135 135
             $this->cache->save($cacheItem);
136 136
             return $data;
Please login to merge, or discard this patch.
src/resta/Cache/CacheContainerResolver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     public function cacheProcess($callback)
18 18
     {
19 19
         //we do cache key control for method cache container data.
20
-        if(isset($this->app['containerReflection']['methodCache']['cache'])){
20
+        if (isset($this->app['containerReflection']['methodCache']['cache'])) {
21 21
 
22 22
             //get cache data
23 23
             $cache = $this->app['containerReflection']['methodCache']['cache'];
Please login to merge, or discard this patch.
src/resta/Cache/CacheConfigDetector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@
 block discarded – undo
18 18
      */
19 19
     public function __construct()
20 20
     {
21
-        if(config('cache.default')!==null){
21
+        if (config('cache.default')!==null) {
22 22
 
23 23
             $default = config('cache.default');
24 24
 
25 25
             $this->config['adapter']  = config('cache.stores.'.$default.'.driver') ?? exception()->invalidArgument('driver for '.$default.' within cache config is not valid');
26
-            $this->config['path']     = config('cache.stores.'.$default.'.path') ?? path()->appResourche().'/Cache' ;
26
+            $this->config['path']     = config('cache.stores.'.$default.'.path') ?? path()->appResourche().'/Cache';
27 27
             $this->config['expire']   = config('cache.stores.'.$default.'.expire') ?? 0;
28 28
         }
29 29
     }
Please login to merge, or discard this patch.
src/resta/Environment/CheckEnvironmentFile.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     {
15 15
         //if the env file does not exist, we automatically detect
16 16
         //that the environment variable is in the production environment.
17
-        if(!file_exists($this->getEnvironmentPath())){
17
+        if (!file_exists($this->getEnvironmentPath())) {
18 18
             return [];
19 19
         }
20 20
 
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
      * @param bool $status
30 30
      * @return mixed
31 31
      */
32
-    public function getEnvironment($status=false)
32
+    public function getEnvironment($status = false)
33 33
     {
34 34
         //If the status value is false then direct path is invoked. If true is sent, variables are sent.
35
-        return (false === $status) ? $this->getEnvironmentPath() : $this->getEnvironmentVariables();
35
+        return (false===$status) ? $this->getEnvironmentPath() : $this->getEnvironmentVariables();
36 36
     }
37 37
 
38 38
     /**
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
     private function identifierEnvironment()
60 60
     {
61 61
         //We parse our environment variables through the yaml file.
62
-        $environment=$this->getEnvironment(true);
62
+        $environment = $this->getEnvironment(true);
63 63
 
64 64
         //the application will automatically throw an exception
65 65
         //if there is no env key in the parse variables.
66
-        if(!isset($environment['env'])){
66
+        if (!isset($environment['env'])) {
67 67
             exception()->invalidArgument('The env key missing on your environment');
68 68
         }
69 69
 
Please login to merge, or discard this patch.
src/resta/Environment/EnvironmentProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
      * @param null $environment
15 15
      * @return string
16 16
      */
17
-    public function environment($var=array(),$environment=null)
17
+    public function environment($var = array(), $environment = null)
18 18
     {
19 19
         //environment is recognized as a production environment directly
20 20
         //if there is no env object in the environment variable.
21 21
         $isProduction = $environment['env'] ?? 'production';
22 22
 
23 23
         //we issue a controlled environment key map for the submitted environment
24
-        return (count($var)===0) ? $isProduction : self::getEnvironmentForVariables($var,$environment);
24
+        return (count($var)===0) ? $isProduction : self::getEnvironmentForVariables($var, $environment);
25 25
     }
26 26
 
27 27
     /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * @param null $environment
32 32
      * @return mixed
33 33
      */
34
-    private static function getEnvironmentForVariables($var=array(),$environment=null)
34
+    private static function getEnvironmentForVariables($var = array(), $environment = null)
35 35
     {
36 36
         //environment variable specified by the variable is checked in the defined file
37 37
         //and the value is returned accordingly.
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public function handle()
47 47
     {
48 48
         //set define for config
49
-        define ('environment',true);
49
+        define('environment', true);
50 50
 
51 51
         //where we do the checks for the environment file type,
52 52
         //and if no configuration file is found, the system throws an exception.
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
      * @param null $configuration
63 63
      * @return void
64 64
      */
65
-    private function set($configuration=null)
65
+    private function set($configuration = null)
66 66
     {
67 67
         //we are doing global registration for env and var value.
68
-        $this->app->register('environmentVariables',$configuration);
69
-        $this->app->register('env',$this->environment([],$this->app['environmentVariables']));
68
+        $this->app->register('environmentVariables', $configuration);
69
+        $this->app->register('env', $this->environment([], $this->app['environmentVariables']));
70 70
     }
71 71
 }
72 72
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Console/CustomConsoleProcess.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
         // command namespace
22 22
         // call custom command namespace
23
-        $commandNamespace = Utils::getNamespace(path()->command()) . '\\' . $this->app->getConsoleClass();
23
+        $commandNamespace = Utils::getNamespace(path()->command()).'\\'.$this->app->getConsoleClass();
24 24
 
25 25
         //return null if there is no command namespace
26 26
         if (!class_exists($commandNamespace)) return null;
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
 
37 37
         // closure binding custom command,move custom namespace as specific
38 38
         // call prepare commander firstly for checking command builder
39
-        return ClosureDispatcher::bind($app)->call(function () use($commandClassResolved,$app) {
39
+        return ClosureDispatcher::bind($app)->call(function() use($commandClassResolved, $app) {
40 40
 
41 41
             $this->prepareCommander($commandClassResolved, function($commandClassResolved) use($app) {
42 42
 
43 43
                 // call bindings for resolving
44 44
                 // call with dependency injection resolving
45
-                $commandBindings=[$commandClassResolved,strtolower($app->getConsoleClassMethod())];
46
-                return DIContainerManager::callBind($commandBindings,app()->applicationProviderBinding($this->app));
45
+                $commandBindings = [$commandClassResolved, strtolower($app->getConsoleClassMethod())];
46
+                return DIContainerManager::callBind($commandBindings, app()->applicationProviderBinding($this->app));
47 47
 
48 48
             });
49 49
         });
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
         $commandNamespace = Utils::getNamespace(path()->command()) . '\\' . $this->app->getConsoleClass();
24 24
 
25 25
         //return null if there is no command namespace
26
-        if (!class_exists($commandNamespace)) return null;
26
+        if (!class_exists($commandNamespace)) {
27
+            return null;
28
+        }
27 29
 
28 30
         //get class resolved
29 31
         $commandClassResolved = app()->resolve($commandNamespace,
Please login to merge, or discard this patch.