Test Setup Failed
Push — master ( 2e45ee...44d819 )
by Php Easy Api
03:34
created
src/resta/Provider/ServiceProvider.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @throws FileNotFoundException
28 28
      */
29
-    private function applyProvider($key,$provider,$method='register')
29
+    private function applyProvider($key, $provider, $method = 'register')
30 30
     {
31 31
         // If the provider classes are a real object
32 32
         // we will run them.
33
-        if(Utils::isNamespaceExists($provider)){
33
+        if (Utils::isNamespaceExists($provider)) {
34 34
 
35 35
             // after determining whether the register or boot methods
36 36
             // we are running the provider.
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
             $providerInstance = $this->app->resolve($provider);
39 39
 
40 40
             //we need to do method check for provider.
41
-            if(method_exists($providerInstance,$method)){
41
+            if (method_exists($providerInstance, $method)) {
42 42
                 $providerInstance->{$method}();
43 43
 
44
-                if($method=="register"){
44
+                if ($method=="register") {
45 45
                     /** @scrutinizer ignore-call */
46
-                    $this->app->register('loadedProviders',$key,$provider);
47
-                    $this->deferrableProvider($providerInstance,$provider);
46
+                    $this->app->register('loadedProviders', $key, $provider);
47
+                    $this->deferrableProvider($providerInstance, $provider);
48 48
                 }
49 49
             }
50 50
         }
@@ -58,48 +58,48 @@  discard block
 block discarded – undo
58 58
      *
59 59
      * @throws FileNotFoundException
60 60
      */
61
-    private function deferrableProvider($providerInstance,$provider)
61
+    private function deferrableProvider($providerInstance, $provider)
62 62
     {
63
-        if($providerInstance instanceof DeferrableProvider && file_exists(serviceJson())){
63
+        if ($providerInstance instanceof DeferrableProvider && file_exists(serviceJson())) {
64 64
             $deferrableProvides = $providerInstance->provides();
65 65
 
66 66
             foreach ($deferrableProvides as $deferrableProvide) {
67
-                if($this->app->has($deferrableProvide)){
67
+                if ($this->app->has($deferrableProvide)) {
68 68
                     JsonHandler::$file = serviceJson();
69 69
                     $serviceJson = JsonHandler::get();
70 70
 
71
-                    if(!isset($serviceJson['providers'][$provider])){
72
-                        JsonHandler::set('providers-deferrable-classes',[
71
+                    if (!isset($serviceJson['providers'][$provider])) {
72
+                        JsonHandler::set('providers-deferrable-classes', [
73 73
                             $provider => true
74 74
                         ]);
75 75
 
76 76
                         $container = $this->app->get($deferrableProvide);
77 77
 
78
-                        if(!is_array($container)){
78
+                        if (!is_array($container)) {
79 79
 
80
-                            if($container instanceof \Closure){
81
-                                JsonHandler::set('container',[
80
+                            if ($container instanceof \Closure) {
81
+                                JsonHandler::set('container', [
82 82
                                     $deferrableProvide => SuperClosure::set($container)
83 83
                                 ]);
84 84
 
85
-                                JsonHandler::set('container-format',[
85
+                                JsonHandler::set('container-format', [
86 86
                                     $deferrableProvide => 'closure'
87 87
                                 ]);
88 88
                             }
89
-                            else{
90
-                                JsonHandler::set('container',[
89
+                            else {
90
+                                JsonHandler::set('container', [
91 91
                                     $deferrableProvide => $container
92 92
                                 ]);
93 93
 
94
-                                JsonHandler::set('container-format',[
94
+                                JsonHandler::set('container-format', [
95 95
                                     $deferrableProvide => 'string'
96 96
                                 ]);
97 97
                             }
98 98
 
99 99
                         }
100
-                        else{
100
+                        else {
101 101
                             foreach ($container as $containerKey=>$containerItem) {
102
-                                JsonHandler::set('container',[
102
+                                JsonHandler::set('container', [
103 103
                                     $deferrableProvide.'.'.$containerKey => SuperClosure::set($containerItem)
104 104
                                 ]);
105 105
                             }
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
      */
119 119
     private function assignerLoadedProvidersInitialCoreValue()
120 120
     {
121
-        if(!isset($this->app['loadedProviders'])){
121
+        if (!isset($this->app['loadedProviders'])) {
122 122
 
123 123
             // for loaded providers,
124 124
             // we register an empty array for the container object.
125 125
             /** @scrutinizer ignore-call */
126
-            $this->app->register('loadedProviders',[]);
126
+            $this->app->register('loadedProviders', []);
127 127
         }
128 128
     }
129 129
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         /** @scrutinizer ignore-call */
139 139
         $providers = $this->app->serviceProviders();
140 140
 
141
-        if(count($providers)){
141
+        if (count($providers)) {
142 142
             $this->providers = $providers;
143 143
         }
144 144
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function handle()
154 154
     {
155
-        define ('serviceprovider',true);
155
+        define('serviceprovider', true);
156 156
 
157 157
         //check providers and resolve
158 158
         $this->resolveProviders($this->getServiceProviders());
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      *
166 166
      * @throws FileNotFoundException
167 167
      */
168
-    public function resolveProviders($providers=array())
168
+    public function resolveProviders($providers = array())
169 169
     {
170 170
         // for loaded providers,
171 171
         // we register an empty array for the container object.
@@ -174,36 +174,36 @@  discard block
 block discarded – undo
174 174
         $serviceJson = [];
175 175
 
176 176
         //first we are running register methods of provider classes.
177
-        foreach($providers as $key=>$provider){
177
+        foreach ($providers as $key=>$provider) {
178 178
 
179
-            if(file_exists(serviceJson())){
179
+            if (file_exists(serviceJson())) {
180 180
                 JsonHandler::$file = serviceJson();
181 181
                 $serviceJson = JsonHandler::get();
182 182
             }
183 183
 
184 184
             // providers can only be installed once.
185 185
             // apply providers and register for kernel
186
-            if(!isset($this->app['loadedProviders'][$key])){
186
+            if (!isset($this->app['loadedProviders'][$key])) {
187 187
 
188
-                if(is_array($provider) && isset($provider['status']) && $provider['status']){
189
-                    if(!isset($serviceJson['providers-deferrable-classes'][$provider['class']])){
190
-                        $this->applyProvider($key,$provider['class']);
188
+                if (is_array($provider) && isset($provider['status']) && $provider['status']) {
189
+                    if (!isset($serviceJson['providers-deferrable-classes'][$provider['class']])) {
190
+                        $this->applyProvider($key, $provider['class']);
191 191
                     }
192 192
 
193 193
                 }
194
-                else{
195
-                    $this->applyProvider($key,$provider);
194
+                else {
195
+                    $this->applyProvider($key, $provider);
196 196
                 }
197 197
 
198 198
             }
199 199
         }
200 200
 
201 201
         //then we are running boot methods of provider classes.
202
-        foreach($providers as $key=>$provider){
202
+        foreach ($providers as $key=>$provider) {
203 203
 
204 204
             //if the providers register is already booted.
205
-            if(isset($this->app['loadedProviders'][$key])){
206
-                $this->applyProvider($key,$provider,'boot');
205
+            if (isset($this->app['loadedProviders'][$key])) {
206
+                $this->applyProvider($key, $provider, 'boot');
207 207
             }
208 208
         }
209 209
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -85,8 +85,7 @@  discard block
 block discarded – undo
85 85
                                 JsonHandler::set('container-format',[
86 86
                                     $deferrableProvide => 'closure'
87 87
                                 ]);
88
-                            }
89
-                            else{
88
+                            } else{
90 89
                                 JsonHandler::set('container',[
91 90
                                     $deferrableProvide => $container
92 91
                                 ]);
@@ -96,8 +95,7 @@  discard block
 block discarded – undo
96 95
                                 ]);
97 96
                             }
98 97
 
99
-                        }
100
-                        else{
98
+                        } else{
101 99
                             foreach ($container as $containerKey=>$containerItem) {
102 100
                                 JsonHandler::set('container',[
103 101
                                     $deferrableProvide.'.'.$containerKey => SuperClosure::set($containerItem)
@@ -190,8 +188,7 @@  discard block
 block discarded – undo
190 188
                         $this->applyProvider($key,$provider['class']);
191 189
                     }
192 190
 
193
-                }
194
-                else{
191
+                } else{
195 192
                     $this->applyProvider($key,$provider);
196 193
                 }
197 194
 
Please login to merge, or discard this patch.
src/resta/Container/ContainerClosureResolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@
 block discarded – undo
18 18
      */
19 19
     public static function get($key)
20 20
     {
21
-        if(file_exists(serviceJson())){
21
+        if (file_exists(serviceJson())) {
22 22
             JsonHandler::$file = serviceJson();
23 23
             $serviceJson = JsonHandler::get();
24 24
 
25
-            if(isset($serviceJson['container'][$key])){
26
-                if($serviceJson['container-format'][$key]=='string'){
25
+            if (isset($serviceJson['container'][$key])) {
26
+                if ($serviceJson['container-format'][$key]=='string') {
27 27
                     return $serviceJson['container'][$key];
28 28
                 }
29 29
                 return SuperClosure::get($serviceJson['container'][$key]);
Please login to merge, or discard this patch.
src/resta/Authenticate/AuthenticateResponse.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         // if the status value is true,
26 26
         // we send output generated from the token value.
27
-        if($this->checkStatus()){
27
+        if ($this->checkStatus()) {
28 28
             $this->setAuthenticateSuccess(true);
29 29
             return true;
30 30
         }
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         // if the status value is true,
42 42
         // we send output generated from the token value.
43
-        if($this->checkStatus()){
43
+        if ($this->checkStatus()) {
44 44
             return true;
45 45
         }
46 46
 
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      */
54 54
     protected function getResult()
55 55
     {
56
-        $result= [];
56
+        $result = [];
57 57
 
58 58
         // if the status value is true,
59 59
         // we send output generated from the token value.
60
-        if($this->checkStatus()){
60
+        if ($this->checkStatus()) {
61 61
             $result['message']                  = 'token success';
62 62
             $result['token']                    = $this->params['token'];
63 63
 
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
      *
79 79
      * @param bool $value
80 80
      */
81
-    private function setAuthenticateSuccess($value=true)
81
+    private function setAuthenticateSuccess($value = true)
82 82
     {
83
-        if(app()->has('authenticateSuccess')){
83
+        if (app()->has('authenticateSuccess')) {
84 84
             app()->terminate('authenticateSuccess');
85 85
         }
86 86
 
87
-        app()->register('authenticateSuccess',$value);
87
+        app()->register('authenticateSuccess', $value);
88 88
     }
89 89
 }
90 90
\ No newline at end of file
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);
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
         $this->touch['kernel/app']                  = $this->provider().'/AppServiceProvider.php';
98 98
         $this->touch['kernel/worker']               = $this->provider().'/WorkerServiceProvider.php';
99 99
         $this->touch['kernel/exception']            = $this->provider().'/ExceptionServiceProvider.php';
100
-        $this->touch['kernel/cache']               = $this->provider().'/CacheServiceProvider.php';
100
+        $this->touch['kernel/cache'] = $this->provider().'/CacheServiceProvider.php';
101 101
         $this->touch['kernel/authenticate']         = $this->provider().'/AuthenticateServiceProvider.php';
102 102
         $this->touch['kernel/role']                 = $this->provider().'/RoleServiceProvider.php';
103 103
         $this->touch['kernel/track']                = $this->provider().'/TrackServiceProvider.php';
104
-        $this->touch['test/testcase']              = $this->test().'/TestCase.php';
104
+        $this->touch['test/testcase'] = $this->test().'/TestCase.php';
105 105
         $this->touch['kernel/consoleevent']         = $this->provider().'/ConsoleEventServiceProvider.php';
106 106
         $this->touch['middleware/authenticate']     = $this->middleware().'/Authenticate.php';
107 107
         $this->touch['middleware/ratelimit']        = $this->middleware().'/RateLimit.php';
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         $this->touch['app/gitignore']               = $this->projectPath().'/.gitignore';
143 143
         $this->touch['app/composer']                = $this->projectPath().'/composer.json';
144 144
         $this->touch['test/index']                  = $this->storage().'/index.html';
145
-        $this->touch['exception/authenticate']      = $this->directory['exceptionDir'] .'/AuthenticateException.php';
145
+        $this->touch['exception/authenticate']      = $this->directory['exceptionDir'].'/AuthenticateException.php';
146 146
 
147 147
         //set project touch
148 148
         $this->file->touch($this);
Please login to merge, or discard this patch.
src/resta/Client/ClientAnnotationManager.php 2 patches
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @param ApplicationContracts $app
26 26
      * @param $request
27 27
      */
28
-    public function __construct(ApplicationContracts $app,$request)
28
+    public function __construct(ApplicationContracts $app, $request)
29 29
     {
30 30
         parent::__construct($app);
31 31
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param $key
42 42
      * @return mixed|void
43 43
      */
44
-    public function annotation($method,$key)
44
+    public function annotation($method, $key)
45 45
     {
46 46
         //set annotation value with getting reflection
47 47
         $reflection = $this->getReflection('reflection')->reflectionMethodParams($method);
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
      * @param string $key
67 67
      * @param null|string $data
68 68
      */
69
-    private function catchException($key,$data)
69
+    private function catchException($key, $data)
70 70
     {
71
-        if(isset($this->exceptionParams[$key])){
71
+        if (isset($this->exceptionParams[$key])) {
72 72
 
73 73
             //get key params for exception params
74 74
             $keyParams = ($this->exceptionParams[$key]['params']) ?? [];
75 75
 
76 76
             //catch exception
77
-            exception($this->exceptionParams[$key]['name'],$keyParams)
77
+            exception($this->exceptionParams[$key]['name'], $keyParams)
78 78
                 ->unexpectedValue($this->exceptionParams[$key]['name'].' input value is not valid as format ('.$data.')');
79 79
         }
80
-        else{
80
+        else {
81 81
             //catch exception
82 82
             exception()->unexpectedValue($key.' input value is not valid as format ('.$data.')');
83 83
         }
@@ -90,23 +90,23 @@  discard block
 block discarded – undo
90 90
      */
91 91
     private function getException($key)
92 92
     {
93
-        if(preg_match('@exception\((.*?)\)\r\n@is',$this->annotation,$exception)){
93
+        if (preg_match('@exception\((.*?)\)\r\n@is', $this->annotation, $exception)) {
94 94
 
95
-            $exceptionSpaceExplode = explode(" ",$exception[1]);
95
+            $exceptionSpaceExplode = explode(" ", $exception[1]);
96 96
 
97
-            foreach ($exceptionSpaceExplode as $exceptions){
98
-                $exceptionsDotExplode = explode(":",$exceptions);
97
+            foreach ($exceptionSpaceExplode as $exceptions) {
98
+                $exceptionsDotExplode = explode(":", $exceptions);
99 99
                 $this->exceptionParams[$key][$exceptionsDotExplode[0]] = $exceptionsDotExplode[1];
100 100
             }
101 101
 
102
-            if(isset($this->exceptionParams[$key]['params'])){
102
+            if (isset($this->exceptionParams[$key]['params'])) {
103 103
 
104
-                $paramsCommaExplode = explode(",",$this->exceptionParams[$key]['params']);
104
+                $paramsCommaExplode = explode(",", $this->exceptionParams[$key]['params']);
105 105
                 unset($this->exceptionParams[$key]['params']);
106 106
 
107
-                foreach ($paramsCommaExplode as $params){
108
-                    $paramsEqualExplode = explode("=",$params);
109
-                    if(isset($paramsEqualExplode[0]) && isset($paramsEqualExplode[1])){
107
+                foreach ($paramsCommaExplode as $params) {
108
+                    $paramsEqualExplode = explode("=", $params);
109
+                    if (isset($paramsEqualExplode[0]) && isset($paramsEqualExplode[1])) {
110 110
                         $this->exceptionParams[$key]['params'][$paramsEqualExplode[0]] = $paramsEqualExplode[1];
111 111
                     }
112 112
                 }
@@ -123,37 +123,37 @@  discard block
 block discarded – undo
123 123
     {
124 124
         // with the method based regex annotation,
125 125
         // we check the rule definition for our requests.
126
-        if(preg_match('@regex\((.*?)\)\r\n@is',$this->annotation,$regex)){
127
-            if(isset($this->inputs[$key])){
126
+        if (preg_match('@regex\((.*?)\)\r\n@is', $this->annotation, $regex)) {
127
+            if (isset($this->inputs[$key])) {
128 128
 
129 129
                 // for the definition of rules,
130 130
                 // our inputs can be array and in this case we offer array option for user comfort.
131
-                if(is_array($this->inputs[$key])){
131
+                if (is_array($this->inputs[$key])) {
132 132
 
133
-                    foreach ($this->inputs[$key] as $this->inputsKey => $this->inputsValue){
133
+                    foreach ($this->inputs[$key] as $this->inputsKey => $this->inputsValue) {
134 134
 
135
-                        if(is_array($this->inputsValue)){
135
+                        if (is_array($this->inputsValue)) {
136 136
 
137
-                            foreach ($this->inputsValue as $inputsValueKey => $inputsValueItem){
138
-                                if(!preg_match('@'.$regex[1].'@is',$inputsValueItem)){
139
-                                    $this->catchException($key,$regex[1]);
137
+                            foreach ($this->inputsValue as $inputsValueKey => $inputsValueItem) {
138
+                                if (!preg_match('@'.$regex[1].'@is', $inputsValueItem)) {
139
+                                    $this->catchException($key, $regex[1]);
140 140
                                 }
141 141
                             }
142 142
 
143 143
                         }
144
-                        else{
145
-                            if(!preg_match('@'.$regex[1].'@is',$this->inputsValue)){
146
-                                $this->catchException($key,$regex[1]);
144
+                        else {
145
+                            if (!preg_match('@'.$regex[1].'@is', $this->inputsValue)) {
146
+                                $this->catchException($key, $regex[1]);
147 147
                             }
148 148
                         }
149 149
 
150 150
                     }
151 151
                 }
152
-                else{
152
+                else {
153 153
 
154 154
                     // we control the regex rule that evaluates when only string arrives.
155
-                    if(!preg_match('@'.$regex[1].'@is',$this->inputs[$key])){
156
-                        $this->catchException($key,$regex[1]);
155
+                    if (!preg_match('@'.$regex[1].'@is', $this->inputs[$key])) {
156
+                        $this->catchException($key, $regex[1]);
157 157
                     }
158 158
                 }
159 159
             }
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
      */
169 169
     private function getRemove($key)
170 170
     {
171
-        if(preg_match('@remove\((.*?)\)\r\n@is',$this->annotation,$remove)){
172
-            if(isset($this->inputs[$key])){
173
-                if(preg_match('@'.$remove[1].'@is',$this->inputs[$key])){
171
+        if (preg_match('@remove\((.*?)\)\r\n@is', $this->annotation, $remove)) {
172
+            if (isset($this->inputs[$key])) {
173
+                if (preg_match('@'.$remove[1].'@is', $this->inputs[$key])) {
174 174
                     unset($this->inputs[$key]);
175 175
                 }
176 176
             }
@@ -184,42 +184,42 @@  discard block
 block discarded – undo
184 184
      */
185 185
     private function getRules($key)
186 186
     {
187
-        if(preg_match('@rule\((.*?)\)|rule\((.*?)\)\r\n@is',$this->annotation,$rule)){
187
+        if (preg_match('@rule\((.*?)\)|rule\((.*?)\)\r\n@is', $this->annotation, $rule)) {
188 188
 
189 189
             $requestRules = $this->getReflection('rules');
190 190
 
191
-            $rules = explode(":",$rule[1]);
192
-            if(isset($this->inputs[$key]) && !is_array($this->inputs[$key])){
193
-                foreach($rules as $rule){
194
-                    if(isset($requestRules[$rule])){
195
-                        if(!preg_match('@'.$requestRules[$rule].'@',$this->inputs[$key])){
196
-                            exception($rule,['key'=>$key])
191
+            $rules = explode(":", $rule[1]);
192
+            if (isset($this->inputs[$key]) && !is_array($this->inputs[$key])) {
193
+                foreach ($rules as $rule) {
194
+                    if (isset($requestRules[$rule])) {
195
+                        if (!preg_match('@'.$requestRules[$rule].'@', $this->inputs[$key])) {
196
+                            exception($rule, ['key'=>$key])
197 197
                                 ->invalidArgument($this->inputs[$key].' input value is not valid for '.$rule.' request rule');
198 198
                         }
199 199
                     }
200 200
                 }
201 201
             }
202
-            else{
202
+            else {
203 203
 
204
-                foreach ($this->inputs[$key] as $ikey=>$input){
204
+                foreach ($this->inputs[$key] as $ikey=>$input) {
205 205
 
206
-                    if(!is_array($input)){
207
-                        foreach($rules as $rule){
208
-                            if(isset($requestRules[$rule])){
209
-                                if(!preg_match('@'.$requestRules[$rule].'@',$input)){
210
-                                    exception($rule,['key'=>''.$key.':'.$input])
206
+                    if (!is_array($input)) {
207
+                        foreach ($rules as $rule) {
208
+                            if (isset($requestRules[$rule])) {
209
+                                if (!preg_match('@'.$requestRules[$rule].'@', $input)) {
210
+                                    exception($rule, ['key'=>''.$key.':'.$input])
211 211
                                         ->invalidArgument($input.' input value is not valid for '.$rule.' request rule');
212 212
                                 }
213 213
                             }
214 214
                         }
215 215
                     }
216
-                    else{
216
+                    else {
217 217
 
218
-                        foreach ($input as $ikey=>$item){
219
-                            foreach($rules as $rule){
220
-                                if(isset($requestRules[$rule])){
221
-                                    if(!preg_match('@'.$requestRules[$rule].'@',$item)){
222
-                                        exception($rule,['key'=>''.$key.':'.$item])
218
+                        foreach ($input as $ikey=>$item) {
219
+                            foreach ($rules as $rule) {
220
+                                if (isset($requestRules[$rule])) {
221
+                                    if (!preg_match('@'.$requestRules[$rule].'@', $item)) {
222
+                                        exception($rule, ['key'=>''.$key.':'.$item])
223 223
                                             ->invalidArgument($item.' input value is not valid for '.$rule.' request rule');
224 224
                                     }
225 225
                                 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -76,8 +76,7 @@  discard block
 block discarded – undo
76 76
             //catch exception
77 77
             exception($this->exceptionParams[$key]['name'],$keyParams)
78 78
                 ->unexpectedValue($this->exceptionParams[$key]['name'].' input value is not valid as format ('.$data.')');
79
-        }
80
-        else{
79
+        } else{
81 80
             //catch exception
82 81
             exception()->unexpectedValue($key.' input value is not valid as format ('.$data.')');
83 82
         }
@@ -140,16 +139,14 @@  discard block
 block discarded – undo
140 139
                                 }
141 140
                             }
142 141
 
143
-                        }
144
-                        else{
142
+                        } else{
145 143
                             if(!preg_match('@'.$regex[1].'@is',$this->inputsValue)){
146 144
                                 $this->catchException($key,$regex[1]);
147 145
                             }
148 146
                         }
149 147
 
150 148
                     }
151
-                }
152
-                else{
149
+                } else{
153 150
 
154 151
                     // we control the regex rule that evaluates when only string arrives.
155 152
                     if(!preg_match('@'.$regex[1].'@is',$this->inputs[$key])){
@@ -198,8 +195,7 @@  discard block
 block discarded – undo
198 195
                         }
199 196
                     }
200 197
                 }
201
-            }
202
-            else{
198
+            } else{
203 199
 
204 200
                 foreach ($this->inputs[$key] as $ikey=>$input){
205 201
 
@@ -212,8 +208,7 @@  discard block
 block discarded – undo
212 208
                                 }
213 209
                             }
214 210
                         }
215
-                    }
216
-                    else{
211
+                    } else{
217 212
 
218 213
                         foreach ($input as $ikey=>$item){
219 214
                             foreach($rules as $rule){
Please login to merge, or discard this patch.