Test Failed
Push — master ( 878578...37e8ab )
by Php Easy Api
07:30
created
src/resta/Traits/NamespaceForRoute.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function resolveMethod($method)
58 58
     {
59
-        $method=str_replace(httpMethod(),'',$method);
60
-        $method=str_replace(StaticPathModel::$methodPrefix,'',$method);
59
+        $method = str_replace(httpMethod(), '', $method);
60
+        $method = str_replace(StaticPathModel::$methodPrefix, '', $method);
61 61
         return $method;
62 62
     }
63 63
 
@@ -105,16 +105,16 @@  discard block
 block discarded – undo
105 105
         //If controller does not have a method after checking whether the method specified in the controller class exists,
106 106
         //then by default we assign a default method value of indexAction.
107 107
         //This value must match the class strictly, otherwise the controller can not be called
108
-        if(method_exists($this->app['instanceController'],$this->getPrefixMethod())){
108
+        if (method_exists($this->app['instanceController'], $this->getPrefixMethod())) {
109 109
 
110 110
             //method value as normal
111
-            return $this->setViaDefine($this->getPrefixMethod(),$globalInstance);
111
+            return $this->setViaDefine($this->getPrefixMethod(), $globalInstance);
112 112
         }
113 113
 
114 114
         //by default we assign a default method value of indexAction
115 115
         //this value must be a method value automatically named indexAction
116 116
         //if it does not come from the url discovery value
117
-        return $this->setViaDefine($this->getPrefixIndexMethod(),$globalInstance);
117
+        return $this->setViaDefine($this->getPrefixIndexMethod(), $globalInstance);
118 118
     }
119 119
 
120 120
     /**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         //If the path variables give values ​​in the methods do we have a method name,
127 127
         //we subtract this value from the route variables.
128
-        return array_values(array_diff(core()->routeParameters,[$method]));
128
+        return array_values(array_diff(core()->routeParameters, [$method]));
129 129
     }
130 130
 
131 131
     /**
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
      * @param $globalInstance Router
134 134
      * @return mixed
135 135
      */
136
-    private function setViaDefine($method,$globalInstance)
136
+    private function setViaDefine($method, $globalInstance)
137 137
     {
138 138
         // we are extracting httpMethod and prefix from
139 139
         // the method variable so that we can extract the salt method name.
140
-        $deleteHttp         = str_replace(httpMethod(),'',$method);
141
-        $methodName         = str_replace(StaticPathModel::$methodPrefix,'',$deleteHttp);
140
+        $deleteHttp         = str_replace(httpMethod(), '', $method);
141
+        $methodName         = str_replace(StaticPathModel::$methodPrefix, '', $deleteHttp);
142 142
 
143 143
         //set as global method name
144 144
         $globalInstance->setMethodNameViaDefine($methodName);
@@ -156,19 +156,19 @@  discard block
 block discarded – undo
156 156
         $fromRoutes         = Route::getRouteResolve();
157 157
         $namespace          = null;
158 158
 
159
-        if(count($fromRoutes)){
160
-            $fromRoutesClass    = (isset($fromRoutes['class'])) ? $fromRoutes['class'] : null;
159
+        if (count($fromRoutes)) {
160
+            $fromRoutesClass = (isset($fromRoutes['class'])) ? $fromRoutes['class'] : null;
161 161
 
162
-            if($fromRoutes['namespace']===null){
162
+            if ($fromRoutes['namespace']===null) {
163 163
                 $namespace = Utils::getNamespace($fromRoutes['controller']).'\\'.$fromRoutesClass;
164 164
             }
165
-            else{
165
+            else {
166 166
                 $namespace = Utils::getNamespace($fromRoutes['controller']).'\\'.$fromRoutes['namespace'].'\\'.$fromRoutesClass;
167 167
             }
168 168
         }
169 169
 
170 170
         //check namespace exists
171
-        if(Utils::isNamespaceExists($namespace)){
171
+        if (Utils::isNamespaceExists($namespace)) {
172 172
 
173 173
             // the controller classes are registered in the config controller.
174 174
             // the controller class is not executed if it is not available here.
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     public function checkAutoService($instance)
189 189
     {
190 190
         //If auto service is present, this auto service will be accepted as endpoint namespace.
191
-        return $this->checkEndpointForAutoService()->getNamespaceForAutoService($instance,function(){
191
+        return $this->checkEndpointForAutoService()->getNamespaceForAutoService($instance, function() {
192 192
             exception()->notFoundException('Any endpoint is not available');
193 193
         });
194 194
     }
@@ -200,19 +200,19 @@  discard block
 block discarded – undo
200 200
     {
201 201
         $configController = config('controller');
202 202
 
203
-        if($configController===null
203
+        if ($configController===null
204 204
             OR !isset($configController[$this->endpoint()])
205
-            or !isset($configController[$this->endpoint()][$namespace])){
205
+            or !isset($configController[$this->endpoint()][$namespace])) {
206 206
             exception()->badFunctionCall('The request has not been saved in your configuration settings.');
207 207
         }
208 208
 
209 209
         $configController = $configController[$this->endpoint()][$namespace];
210 210
 
211
-        if(isset($configController[environment()]) and $configController[environment()]===false){
211
+        if (isset($configController[environment()]) and $configController[environment()]===false) {
212 212
             exception()->domain('Sorry, this endpoint is not allowed to run for this environment.');
213 213
         }
214 214
 
215
-        if(isset($configController['all']) AND $configController['all']===false){
215
+        if (isset($configController['all']) AND $configController['all']===false) {
216 216
             exception()->domain('Sorry, this endpoint is never allowed to run.');
217 217
         }
218 218
     }
Please login to merge, or discard this patch.