Passed
Branch master (a3b8ff)
by Php Easy Api
05:59 queued 02:52
created
src/resta/Encrypter/EncrypterProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
     public function handle()
22 22
     {
23 23
         //set define for encrypter
24
-        define('encrypter',true);
24
+        define('encrypter', true);
25 25
 
26 26
         //get encrypter file
27 27
         $encrypterFile = path()->encrypterFile();
28 28
 
29 29
         //throws an exception it there is no encrypter file
30
-        if(!file_exists($encrypterFile)){
30
+        if (!file_exists($encrypterFile)) {
31 31
             exception()->domain('The Application key is invalid');
32 32
         }
33 33
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         //we are checking two values ​​for key comparison.1.st separated value encryption
38 38
         //key second separated value crypto closure value
39
-        $appKey = explode("__",$appKeyFile['key']);
39
+        $appKey = explode("__", $appKeyFile['key']);
40 40
 
41 41
         //we are assigning a singleton object
42 42
         //so that we can use our application key in the project.
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     {
57 57
         //we are assigning a singleton object
58 58
         //so that we can use our application key in the project.
59
-        $this->app->register('applicationKey',current($key));
59
+        $this->app->register('applicationKey', current($key));
60 60
     }
61 61
 
62 62
 
Please login to merge, or discard this patch.
src/resta/Url/UrlParseParamResolved.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         //check url parse data for exception
19 19
         $this->url = $app->urlList;
20 20
 
21
-        if(is_null($app->getPath())){
21
+        if (is_null($app->getPath())) {
22 22
             $this->exception($this->url);
23 23
         }
24 24
 
Please login to merge, or discard this patch.
src/resta/Url/UrlProvider.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * @var array $urlNames
23 23
      */
24
-    protected $urlNames = ['project','version','endpoint','method'];
24
+    protected $urlNames = ['project', 'version', 'endpoint', 'method'];
25 25
 
26 26
     /**
27 27
      * assign url list
@@ -39,25 +39,25 @@  discard block
 block discarded – undo
39 39
         // it will be formatted.
40 40
         $query = $this->queryFormatProcess($query);
41 41
 
42
-        foreach ($query as $key=>$value){
42
+        foreach ($query as $key=>$value) {
43 43
 
44 44
             //set url list for urlNames property
45
-            if(isset($this->urlNames[$key])){
46
-                $this->getUrlListValues($key,$value);
45
+            if (isset($this->urlNames[$key])) {
46
+                $this->getUrlListValues($key, $value);
47 47
             }
48 48
         }
49 49
 
50 50
         // If there is no method key in the urlList property,
51 51
         // then by default we assign the index to the method property.
52
-        if(!isset($this->urlList['method'])){
52
+        if (!isset($this->urlList['method'])) {
53 53
             $this->urlList['method'] = 'index';
54 54
         }
55 55
 
56 56
         //determines the endpoint method for your project
57
-        $this->urlList['parameters'] = array_slice($query,3);
57
+        $this->urlList['parameters'] = array_slice($query, 3);
58 58
 
59 59
         //url global instance
60
-        if($this->app->has('routeParameters')===false){
60
+        if ($this->app->has('routeParameters')===false) {
61 61
             $this->definitor($this->urlList);
62 62
         }
63 63
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
         //convert array for query
76 76
         //we are removing the first empty element from the array due to the slash sign.
77
-        if(is_null($this->path)){
77
+        if (is_null($this->path)) {
78 78
             $query = $this->getRequestPathInfo();
79 79
         }
80 80
 
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function definitor($urlList)
98 98
     {
99
-        define('version',$urlList['version']);
100
-        define('endpoint',$urlList['endpoint']);
101
-        define('app',$urlList['project']);
102
-        define('method',$urlList['method']);
99
+        define('version', $urlList['version']);
100
+        define('endpoint', $urlList['endpoint']);
101
+        define('app', $urlList['project']);
102
+        define('method', $urlList['method']);
103 103
 
104 104
         //route parameters kernel object register
105
-        $this->app->register('routeParameters',$urlList['parameters']);
105
+        $this->app->register('routeParameters', $urlList['parameters']);
106 106
     }
107 107
 
108 108
     /**
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
      * @param array $path
122 122
      * @return array
123 123
      */
124
-    public function getRequestPathInfo($path=array())
124
+    public function getRequestPathInfo($path = array())
125 125
     {
126
-        if(count($path)){
126
+        if (count($path)) {
127 127
             $this->path = $path;
128 128
         }
129
-        else{
129
+        else {
130 130
             return Utils::getRequestPathInfo();
131 131
         }
132 132
     }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      * @param $key
138 138
      * @param $value
139 139
      */
140
-    private function getUrlListValues($key,$value)
140
+    private function getUrlListValues($key, $value)
141 141
     {
142 142
         //If the value from the url is an external value, the default format is applied.
143 143
         $this->urlList[$this->urlNames[$key]] = (strlen($value)>0) ? $value : null;
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         $this->assignUrlList();
157 157
 
158 158
         //register to container urlComponent value
159
-        $this->app->register('urlComponent',$this->urlList);
159
+        $this->app->register('urlComponent', $this->urlList);
160 160
 
161 161
         //we make url parse resolving with resolved
162 162
         return (new UrlParseParamResolved)->urlParamResolve($this);
@@ -172,20 +172,20 @@  discard block
 block discarded – undo
172 172
     {
173 173
         // at urlNames property,
174 174
         // we get the key of the version value registered.
175
-        $versionKey = array_search('version',$this->urlNames);
175
+        $versionKey = array_search('version', $this->urlNames);
176 176
 
177 177
         // if the query array has a version key,
178 178
         // and the value does not start with Vnumber, the version will definitely be formatted.
179
-        if(isset($query[$versionKey]) && !preg_match('@V(\d+)@',$query[$versionKey])){
180
-            $query = Arr::overwriteWith($query,[$versionKey=>'V1']);
179
+        if (isset($query[$versionKey]) && !preg_match('@V(\d+)@', $query[$versionKey])) {
180
+            $query = Arr::overwriteWith($query, [$versionKey=>'V1']);
181 181
         }
182
-        else{
182
+        else {
183 183
 
184
-            if(!isset($query[$versionKey])){
184
+            if (!isset($query[$versionKey])) {
185 185
                 $query[$versionKey] = 'V1';
186 186
             }
187 187
 
188
-            if(!isset($query[$versionKey+1])){
188
+            if (!isset($query[$versionKey+1])) {
189 189
                 $query[$versionKey+1] = NULL;
190 190
             }
191 191
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,8 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         if(count($path)){
127 127
             $this->path = $path;
128
-        }
129
-        else{
128
+        } else{
130 129
             return Utils::getRequestPathInfo();
131 130
         }
132 131
     }
@@ -178,8 +177,7 @@  discard block
 block discarded – undo
178 177
         // and the value does not start with Vnumber, the version will definitely be formatted.
179 178
         if(isset($query[$versionKey]) && !preg_match('@V(\d+)@',$query[$versionKey])){
180 179
             $query = Arr::overwriteWith($query,[$versionKey=>'V1']);
181
-        }
182
-        else{
180
+        } else{
183 181
 
184 182
             if(!isset($query[$versionKey])){
185 183
                 $query[$versionKey] = 'V1';
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
-            $watch=core()->controllerWatch;
24
-            return array_merge($printer,['watch'=>['memory'=>$watch['memory']]]);
23
+            $watch = core()->controllerWatch;
24
+            return array_merge($printer, ['watch'=>['memory'=>$watch['memory']]]);
25 25
         }
26 26
 
27 27
         //return printer
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
      * @param array $data
49 49
      * @return array
50 50
      */
51
-    private function hateoasCapsule($data=array())
51
+    private function hateoasCapsule($data = array())
52 52
     {
53
-        return (config('app.hateoas')) ? array_merge($data,config('hateoas')) : $data;
53
+        return (config('app.hateoas')) ? array_merge($data, config('hateoas')) : $data;
54 54
     }
55 55
 
56 56
     /**
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
      * @param callable $callback
67 67
      * @return mixed
68 68
      */
69
-    private function noInExceptionHateoas($output,callable $callback)
69
+    private function noInExceptionHateoas($output, callable $callback)
70 70
     {
71
-        if(isset($output['success']) && false===$output['success']){
71
+        if (isset($output['success']) && false===$output['success']) {
72 72
             return $output;
73 73
         }
74 74
         return call_user_func($callback);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     {
96 96
         //if the system throws an exception,
97 97
         //we subtract the hateoas extension from the output value.
98
-        $this->printer = $this->noInExceptionHateoas($output,function() use ($output){
98
+        $this->printer = $this->noInExceptionHateoas($output, function() use ($output){
99 99
 
100 100
             return array_merge(
101 101
                 $this->metaAdd(),
@@ -105,16 +105,16 @@  discard block
 block discarded – undo
105 105
 
106 106
         // For the data to be included in the response,
107 107
         // we go to the dataIncludedForPrinter method.
108
-        $this->printer=$this->dataIncludedForPrinter($this->printer);
108
+        $this->printer = $this->dataIncludedForPrinter($this->printer);
109 109
 
110 110
         // If the log feature is available on the kernel,
111 111
         // we run the logger process.
112
-        if(isset(core()->log)){
112
+        if (isset(core()->log)) {
113 113
 
114 114
             // we can run logging after checking
115 115
             // the configuration for the logger process in the LoggerService class
116 116
             // so that,If logging is not allowed in the main configuration file, we will not log.
117
-            return core()->loggerService->checkLoggerConfiguration($this->printer,function($printer){
117
+            return core()->loggerService->checkLoggerConfiguration($this->printer, function($printer) {
118 118
                 return $printer;
119 119
             });
120 120
         }
Please login to merge, or discard this patch.
src/resta/Response/ResponseProvider.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  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
 
@@ -68,8 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         //we get the response type by checking the instanceController object from the router.
70 70
         //Each type of response is in the base class in project directory.
71
-        return ($this->getControllerInstance()===null) ? core()->responseType :
72
-            $this->appResponseType();
71
+        return ($this->getControllerInstance()===null) ? core()->responseType : $this->appResponseType();
73 72
     }
74 73
 
75 74
     /**
@@ -80,19 +79,19 @@  discard block
 block discarded – undo
80 79
     public function handle()
81 80
     {
82 81
         //definition for singleton instance
83
-        define ('responseApp',true);
82
+        define('responseApp', true);
84 83
 
85 84
         //get out putter for response
86 85
         $formatter = $this->formatter();
87 86
 
88 87
         //if out putter is not null
89
-        if(Utils::isNamespaceExists($formatter)){
88
+        if (Utils::isNamespaceExists($formatter)) {
90 89
 
91 90
             //We resolve the response via the service container
92 91
             //and run the handle method.
93 92
             $result = app()->resolve($formatter)->{$this->getResponseKind()}($this->getOutPutter());
94 93
 
95
-            $this->app->register('result',$result);
94
+            $this->app->register('result', $result);
96 95
         }
97 96
     }
98 97
 
@@ -102,7 +101,7 @@  discard block
 block discarded – undo
102 101
      * @param array $data
103 102
      * @return array
104 103
      */
105
-    public function outputFormatter($data=array())
104
+    public function outputFormatter($data = array())
106 105
     {
107 106
         $dataCapsule = config('response.data');
108 107
 
Please login to merge, or discard this patch.
src/resta/Response/Outputter/XmlOutputter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
      * @param $outputter
11 11
      * @return string
12 12
      */
13
-    public function handle($outputter){
13
+    public function handle($outputter) {
14 14
 
15 15
         header('Content-type:application/xml;charset=utf-8');
16 16
         return ArrayToXml::convert($outputter);
Please login to merge, or discard this patch.
src/resta/Response/Outputter/JsonOutputter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
      * @param $outputter
11 11
      * @return string
12 12
      */
13
-    public function handle($outputter){
13
+    public function handle($outputter) {
14 14
 
15 15
         //header set and symfony response call
16 16
         header('Content-type:application/json;charset=utf-8');
Please login to merge, or discard this patch.
src/resta/Response/ResponseOutManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 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
     /**
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function json()
25 25
     {
26
-        $this->app->response='json';
26
+        $this->app->response = 'json';
27 27
     }
28 28
 
29 29
     /**
@@ -31,6 +31,6 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function xml()
33 33
     {
34
-        $this->app->response='xml';
34
+        $this->app->response = 'xml';
35 35
     }
36 36
 }
37 37
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Request/Request.php 2 patches
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         // if we leave the request process to the application side,
59 59
         // then in this case we refer to the requestClient object in
60 60
         // the services section of the store directory.
61
-        (property_exists($this,'app') && $this->app) ? parent::handle() : $this->handle();
61
+        (property_exists($this, 'app') && $this->app) ? parent::handle() : $this->handle();
62 62
     }
63 63
 
64 64
     /**
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
      */
69 69
     private function autoValidate($validate)
70 70
     {
71
-        foreach ($this->{$validate} as $object=>$datas){
72
-            if(Utils::isNamespaceExists($object)){
71
+        foreach ($this->{$validate} as $object=>$datas) {
72
+            if (Utils::isNamespaceExists($object)) {
73 73
                 $getObjectInstance = app()->resolve($object);
74
-                foreach ($datas as $dataKey=>$data){
75
-                    if(is_numeric($dataKey) && method_exists($getObjectInstance,$data)){
76
-                        if(isset($this->origin[$data])){
77
-                            if(!is_array($this->origin[$data])){
74
+                foreach ($datas as $dataKey=>$data) {
75
+                    if (is_numeric($dataKey) && method_exists($getObjectInstance, $data)) {
76
+                        if (isset($this->origin[$data])) {
77
+                            if (!is_array($this->origin[$data])) {
78 78
                                 $this->origin[$data] = array($this->origin[$data]);
79 79
                             }
80
-                            foreach ($this->origin[$data] as $originData){
80
+                            foreach ($this->origin[$data] as $originData) {
81 81
                                 $getObjectInstance->{$data}($originData);
82 82
                             }
83 83
                         }
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
 
100 100
         // Determines which HTTP method
101 101
         // the request object will be exposed to.
102
-        if($this->checkProperties('http')){
102
+        if ($this->checkProperties('http')) {
103 103
 
104 104
             // if the current http method does not exist
105 105
             // in the http object, the exception will be thrown.
106
-            if(!in_array($method,$this->http)){
106
+            if (!in_array($method, $this->http)) {
107 107
 
108 108
                 //exception batMethodCall
109 109
                 exception()->badMethodCall(
110
-                    'Invalid http method process for '.class_basename($this).'.That is accepted http methods ['.implode(",",$this->http).'] ');
110
+                    'Invalid http method process for '.class_basename($this).'.That is accepted http methods ['.implode(",", $this->http).'] ');
111 111
             }
112 112
         }
113 113
     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     {
123 123
         // from the properties of the object properties to
124 124
         // the existing variables, control the array and at least one element.
125
-        return (property_exists($this,$properties)
125
+        return (property_exists($this, $properties)
126 126
             && is_array($this->{$properties}) && count($this->{$properties})) ? true : false;
127 127
     }
128 128
 
@@ -135,15 +135,15 @@  discard block
 block discarded – undo
135 135
     public function except($except)
136 136
     {
137 137
         // the except parameter is a callable value.
138
-        if(is_callable($except)){
139
-            $call = call_user_func_array($except,[$this]);
138
+        if (is_callable($except)) {
139
+            $call = call_user_func_array($except, [$this]);
140 140
             $except = $call;
141 141
         }
142 142
 
143 143
         // except with the except exceptions property
144 144
         // and then assigning them to the inputs property.
145
-        $this->except = array_merge($this->except,$except);
146
-        $this->inputs = array_diff_key($this->inputs,array_flip($this->except));
145
+        $this->except = array_merge($this->except, $except);
146
+        $this->inputs = array_diff_key($this->inputs, array_flip($this->except));
147 147
 
148 148
         return $this;
149 149
     }
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
     {
158 158
         // expected method is executed.
159 159
         // this method is a must for http method values to be found in this property.
160
-        if($this->checkProperties('expected')){
160
+        if ($this->checkProperties('expected')) {
161 161
 
162 162
             // if the expected values are not found in the inputs array,
163 163
             // the exception will be thrown.
164
-            foreach ($this->expected as $expected){
165
-                if(!isset($this->inputs[$expected])){
164
+            foreach ($this->expected as $expected) {
165
+                if (!isset($this->inputs[$expected])) {
166 166
                     exception()->unexpectedValue('You absolutely have to send the value '.$expected.' for request object');
167 167
                 }
168 168
             }
@@ -178,17 +178,17 @@  discard block
 block discarded – undo
178 178
     {
179 179
         // check the presence of the generator object
180 180
         // and operate the generator over this object.
181
-        if($this->checkProperties('auto_generators')){
181
+        if ($this->checkProperties('auto_generators')) {
182 182
             $generators = $this->auto_generators;
183 183
         }
184 184
 
185 185
         // check the presence of the generator object
186 186
         // and operate the generator over this object.
187
-        if($this->checkProperties('generators')){
188
-            $generators = array_merge(isset($generators) ? $generators: [],$this->generators);
187
+        if ($this->checkProperties('generators')) {
188
+            $generators = array_merge(isset($generators) ? $generators : [], $this->generators);
189 189
         }
190 190
 
191
-        if(isset($generators)){
191
+        if (isset($generators)) {
192 192
             $this->generatorMethod($generators);
193 193
         }
194 194
     }
@@ -201,30 +201,30 @@  discard block
 block discarded – undo
201 201
     private function generatorMethod($generators)
202 202
     {
203 203
         //generator array object
204
-        foreach ($generators as $generator){
204
+        foreach ($generators as $generator) {
205 205
 
206 206
             //generator method name
207 207
             $generatorMethodName = $generator.'Generator';
208 208
 
209 209
             // if the generator method is present,
210 210
             // the fake value is assigned.
211
-            if(method_exists($this,$generatorMethodName)){
211
+            if (method_exists($this, $generatorMethodName)) {
212 212
 
213 213
                 //fake registration
214
-                if(!isset($this->inputs[$generator])){
214
+                if (!isset($this->inputs[$generator])) {
215 215
                     $this->{$generator} = $this->{$generatorMethodName}();
216 216
                     $this->inputs[$generator] = $this->{$generatorMethodName}();
217 217
                 }
218 218
                 else {
219 219
 
220
-                    if($this->checkProperties('auto_generators_dont_overwrite')
221
-                        && in_array($generator,$this->auto_generators_dont_overwrite)){
220
+                    if ($this->checkProperties('auto_generators_dont_overwrite')
221
+                        && in_array($generator, $this->auto_generators_dont_overwrite)) {
222 222
                         $this->{$generator} = $this->{$generatorMethodName}();
223 223
                         $this->inputs[$generator] = $this->{$generatorMethodName}();
224 224
                     }
225 225
 
226
-                    if($this->checkProperties('generators_dont_overwrite')
227
-                        && in_array($generator,$this->generators_dont_overwrite)){
226
+                    if ($this->checkProperties('generators_dont_overwrite')
227
+                        && in_array($generator, $this->generators_dont_overwrite)) {
228 228
                         $this->{$generator} = $this->{$generatorMethodName}();
229 229
                         $this->inputs[$generator] = $this->{$generatorMethodName}();
230 230
                     }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      */
254 254
     private function getClientObjects()
255 255
     {
256
-        return array_diff_key($this->getObjects(),['inputs'=>[]]);
256
+        return array_diff_key($this->getObjects(), ['inputs'=>[]]);
257 257
     }
258 258
 
259 259
     /**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
     {
297 297
         // we use the http method to write
298 298
         // the values to the inputs and origin properties.
299
-        foreach($this->requestHttp->resolve() as $key=>$value){
299
+        foreach ($this->requestHttp->resolve() as $key=>$value) {
300 300
 
301 301
             //inputs and origin properties
302 302
             $this->inputs[$key] = $value;
@@ -312,68 +312,68 @@  discard block
 block discarded – undo
312 312
      *
313 313
      * @throws \ReflectionException
314 314
      */
315
-    private function checkAnnotations($method,$key)
315
+    private function checkAnnotations($method, $key)
316 316
     {
317 317
         $reflection = $this->reflection->reflectionMethodParams($method);
318 318
         $annotation = $reflection->document;
319 319
 
320 320
         $exceptionParamList = [];
321 321
 
322
-        if(preg_match('@exception\((.*?)\)\r\n@is',$annotation,$exception)){
322
+        if (preg_match('@exception\((.*?)\)\r\n@is', $annotation, $exception)) {
323 323
 
324
-            $exceptionSpaceExplode = explode(" ",$exception[1]);
325
-            foreach ($exceptionSpaceExplode as $exceptions){
326
-                $exceptionsDotExplode = explode(":",$exceptions);
324
+            $exceptionSpaceExplode = explode(" ", $exception[1]);
325
+            foreach ($exceptionSpaceExplode as $exceptions) {
326
+                $exceptionsDotExplode = explode(":", $exceptions);
327 327
                 $exceptionParamList[$key][$exceptionsDotExplode[0]] = $exceptionsDotExplode[1];
328 328
             }
329 329
 
330
-            if(isset($exceptionParamList[$key]['params'])){
331
-                $paramsCommaExplode = explode(",",$exceptionParamList[$key]['params']);
330
+            if (isset($exceptionParamList[$key]['params'])) {
331
+                $paramsCommaExplode = explode(",", $exceptionParamList[$key]['params']);
332 332
                 unset($exceptionParamList[$key]['params']);
333
-                foreach ($paramsCommaExplode as $params){
334
-                    $paramsEqualExplode = explode("=",$params);
335
-                    if(isset($paramsEqualExplode[0]) && isset($paramsEqualExplode[1])){
333
+                foreach ($paramsCommaExplode as $params) {
334
+                    $paramsEqualExplode = explode("=", $params);
335
+                    if (isset($paramsEqualExplode[0]) && isset($paramsEqualExplode[1])) {
336 336
                         $exceptionParamList[$key]['params'][$paramsEqualExplode[0]] = $paramsEqualExplode[1];
337 337
                     }
338 338
                 }
339 339
             }
340 340
         }
341 341
 
342
-        if(preg_match('@remove\((.*?)\)\r\n@is',$annotation,$remove)){
343
-            if(isset($this->inputs[$key])){
344
-                if(preg_match('@'.$remove[1].'@is',$this->inputs[$key])){
342
+        if (preg_match('@remove\((.*?)\)\r\n@is', $annotation, $remove)) {
343
+            if (isset($this->inputs[$key])) {
344
+                if (preg_match('@'.$remove[1].'@is', $this->inputs[$key])) {
345 345
                     unset($this->inputs[$key]);
346 346
                 }
347 347
             }
348 348
         }
349 349
 
350
-        if(preg_match('@regex\((.*?)\)\r\n@is',$annotation,$regex)){
351
-            if(isset($this->inputs[$key])){
350
+        if (preg_match('@regex\((.*?)\)\r\n@is', $annotation, $regex)) {
351
+            if (isset($this->inputs[$key])) {
352 352
 
353
-                if(is_array($this->inputs[$key])){
353
+                if (is_array($this->inputs[$key])) {
354 354
 
355
-                    foreach ($this->inputs[$key] as $inputKey=>$inputValue){
355
+                    foreach ($this->inputs[$key] as $inputKey=>$inputValue) {
356 356
 
357
-                        if(!preg_match('@'.$regex[1].'@is',$inputValue)){
358
-                            if(isset($exceptionParamList[$key])){
357
+                        if (!preg_match('@'.$regex[1].'@is', $inputValue)) {
358
+                            if (isset($exceptionParamList[$key])) {
359 359
                                 $keyParams = ($exceptionParamList[$key]['params']) ?? [];
360
-                                exception($exceptionParamList[$key]['name'],$keyParams)->unexpectedValue($key.' input value is not valid as format ('.$regex[1].')');
360
+                                exception($exceptionParamList[$key]['name'], $keyParams)->unexpectedValue($key.' input value is not valid as format ('.$regex[1].')');
361 361
                             }
362
-                            else{
362
+                            else {
363 363
                                 exception()->unexpectedValue($key.' input value is not valid as format ('.$regex[1].')');
364 364
                             }
365 365
                         }
366 366
                     }
367 367
 
368 368
                 }
369
-                else{
369
+                else {
370 370
 
371
-                    if(!preg_match('@'.$regex[1].'@is',$this->inputs[$key])){
372
-                        if(isset($exceptionParamList[$key])){
371
+                    if (!preg_match('@'.$regex[1].'@is', $this->inputs[$key])) {
372
+                        if (isset($exceptionParamList[$key])) {
373 373
                             $keyParams = ($exceptionParamList[$key]['params']) ?? [];
374
-                            exception($exceptionParamList[$key]['name'],$keyParams)->unexpectedValue($key.' input value is not valid as format ('.$regex[1].')');
374
+                            exception($exceptionParamList[$key]['name'], $keyParams)->unexpectedValue($key.' input value is not valid as format ('.$regex[1].')');
375 375
                         }
376
-                        else{
376
+                        else {
377 377
                             exception()->unexpectedValue($key.' input value is not valid as format ('.$regex[1].')');
378 378
                         }
379 379
                     }
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
 
420 420
         // we update the input values ​​after
421 421
         // we receive and check the saved objects.
422
-        foreach ($clientObjects as $key=>$value){
422
+        foreach ($clientObjects as $key=>$value) {
423 423
 
424
-            if(isset($clientObjects['origin'][$key])){
424
+            if (isset($clientObjects['origin'][$key])) {
425 425
 
426 426
                 $this->{$key} = $clientObjects['origin'][$key];
427 427
                 $this->inputs[$key] = $this->{$key};
@@ -446,11 +446,11 @@  discard block
 block discarded – undo
446 446
 
447 447
         // the request update to be performed using
448 448
         // the method name to be used with the http method.
449
-        $this->setRequestInputs($requestMethod,$key);
449
+        $this->setRequestInputs($requestMethod, $key);
450 450
 
451 451
         // the request update to be performed using
452 452
         // the method name to be used without the http method.
453
-        $this->setRequestInputs($key,$key);
453
+        $this->setRequestInputs($key, $key);
454 454
     }
455 455
 
456 456
     /**
@@ -459,27 +459,27 @@  discard block
 block discarded – undo
459 459
      * @param $method
460 460
      * @param $key
461 461
      */
462
-    private function setRequestInputs($method,$key)
462
+    private function setRequestInputs($method, $key)
463 463
     {
464
-        if(method_exists($this,$method) && $this->reflection->reflectionMethodParams($method)->isProtected){
464
+        if (method_exists($this, $method) && $this->reflection->reflectionMethodParams($method)->isProtected) {
465 465
 
466 466
             //check annotations for method
467
-            $this->checkAnnotations($method,$key);
467
+            $this->checkAnnotations($method, $key);
468 468
 
469
-            if(isset($this->inputs[$key]) && is_array($this->inputs[$key])){
469
+            if (isset($this->inputs[$key]) && is_array($this->inputs[$key])) {
470 470
 
471 471
                 $inputKeys = $this->inputs[$key];
472 472
 
473 473
                 $this->inputs[$key] = [];
474
-                foreach ($inputKeys as $input){
474
+                foreach ($inputKeys as $input) {
475 475
 
476 476
                     $this->{$key}           = $input;
477 477
                     $keyMethod              = $this->{$method}();
478 478
                     $this->inputs[$key][]   = $keyMethod;
479 479
                 }
480 480
             }
481
-            else{
482
-                if(isset($this->inputs[$key])){
481
+            else {
482
+                if (isset($this->inputs[$key])) {
483 483
                     $keyMethod = $this->{$method}();
484 484
                     $this->inputs[$key] = $keyMethod;
485 485
                 }
@@ -495,22 +495,22 @@  discard block
 block discarded – undo
495 495
      */
496 496
     private function validation()
497 497
     {
498
-        if(property_exists($this,'autoObjectValidate') && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)){
498
+        if (property_exists($this, 'autoObjectValidate') && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)) {
499 499
             $this->autoValidate('autoObjectValidate');
500 500
         }
501 501
         // we need to find the rule method
502 502
         // because we can not validate it.
503
-        if(method_exists($this,'rule')){
503
+        if (method_exists($this, 'rule')) {
504 504
             $this->rule();
505 505
         }
506 506
 
507 507
         // if we only want to make a rule of
508 508
         // the specified request object, we will use
509 509
         // the rule method with the prefix of the request object.
510
-        $validName=strtolower(str_replace('Request','',class_basename($this))).'Rule';
510
+        $validName = strtolower(str_replace('Request', '', class_basename($this))).'Rule';
511 511
 
512 512
         //if the specified method exists;
513
-        if(method_exists($this,$validName)){
513
+        if (method_exists($this, $validName)) {
514 514
             $this->{$validName}();
515 515
         }
516 516
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -214,8 +214,7 @@  discard block
 block discarded – undo
214 214
                 if(!isset($this->inputs[$generator])){
215 215
                     $this->{$generator} = $this->{$generatorMethodName}();
216 216
                     $this->inputs[$generator] = $this->{$generatorMethodName}();
217
-                }
218
-                else {
217
+                } else {
219 218
 
220 219
                     if($this->checkProperties('auto_generators_dont_overwrite')
221 220
                         && in_array($generator,$this->auto_generators_dont_overwrite)){
@@ -358,22 +357,19 @@  discard block
 block discarded – undo
358 357
                             if(isset($exceptionParamList[$key])){
359 358
                                 $keyParams = ($exceptionParamList[$key]['params']) ?? [];
360 359
                                 exception($exceptionParamList[$key]['name'],$keyParams)->unexpectedValue($key.' input value is not valid as format ('.$regex[1].')');
361
-                            }
362
-                            else{
360
+                            } else{
363 361
                                 exception()->unexpectedValue($key.' input value is not valid as format ('.$regex[1].')');
364 362
                             }
365 363
                         }
366 364
                     }
367 365
 
368
-                }
369
-                else{
366
+                } else{
370 367
 
371 368
                     if(!preg_match('@'.$regex[1].'@is',$this->inputs[$key])){
372 369
                         if(isset($exceptionParamList[$key])){
373 370
                             $keyParams = ($exceptionParamList[$key]['params']) ?? [];
374 371
                             exception($exceptionParamList[$key]['name'],$keyParams)->unexpectedValue($key.' input value is not valid as format ('.$regex[1].')');
375
-                        }
376
-                        else{
372
+                        } else{
377 373
                             exception()->unexpectedValue($key.' input value is not valid as format ('.$regex[1].')');
378 374
                         }
379 375
                     }
@@ -477,8 +473,7 @@  discard block
 block discarded – undo
477 473
                     $keyMethod              = $this->{$method}();
478 474
                     $this->inputs[$key][]   = $keyMethod;
479 475
                 }
480
-            }
481
-            else{
476
+            } else{
482 477
                 if(isset($this->inputs[$key])){
483 478
                     $keyMethod = $this->{$method}();
484 479
                     $this->inputs[$key] = $keyMethod;
Please login to merge, or discard this patch.