@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | public static function getClassToCall(array $action) |
20 | 20 | { |
21 | 21 | Logger::log('Getting class to call for executing the request action', LOG_DEBUG, $action); |
22 | - $actionClass = class_exists($action['class']) ? $action['class'] : "\\" . $action['class']; |
|
22 | + $actionClass = class_exists($action['class']) ? $action['class'] : "\\".$action['class']; |
|
23 | 23 | $reflectionClass = new \ReflectionClass($actionClass); |
24 | - if($reflectionClass->hasMethod('getInstance')) { |
|
24 | + if ($reflectionClass->hasMethod('getInstance')) { |
|
25 | 25 | $class = $reflectionClass->getMethod('getInstance')->invoke(null, $action['method']); |
26 | - } else { |
|
26 | + }else { |
|
27 | 27 | $class = new $actionClass; |
28 | 28 | } |
29 | 29 | return $class; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $expr = preg_quote($expr, '/'); |
113 | 113 | $expr = str_replace('###', '(.*)', $expr); |
114 | 114 | $expr2 = preg_replace('/\(\.\*\)$/', '', $expr); |
115 | - $matched = preg_match('/^' . $expr . '\/?$/i', $path) || preg_match('/^' . $expr2 . '?$/i', $path); |
|
115 | + $matched = preg_match('/^'.$expr.'\/?$/i', $path) || preg_match('/^'.$expr2.'?$/i', $path); |
|
116 | 116 | return $matched; |
117 | 117 | } |
118 | 118 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public static function extractDomainInfo(\ReflectionClass $class, $domain) |
125 | 125 | { |
126 | - $path = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; |
|
127 | - $path = realpath($path) . DIRECTORY_SEPARATOR; |
|
126 | + $path = dirname($class->getFileName()).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR; |
|
127 | + $path = realpath($path).DIRECTORY_SEPARATOR; |
|
128 | 128 | $templatesPath = 'templates'; |
129 | 129 | $publicPath = 'public'; |
130 | 130 | $modelsPath = 'models'; |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | $modelsPath = ucfirst($modelsPath); |
135 | 135 | } |
136 | 136 | if ($class->hasConstant('TPL')) { |
137 | - $templatesPath .= DIRECTORY_SEPARATOR . $class->getConstant('TPL'); |
|
137 | + $templatesPath .= DIRECTORY_SEPARATOR.$class->getConstant('TPL'); |
|
138 | 138 | } |
139 | 139 | return [ |
140 | 140 | 'base' => $path, |
141 | - 'template' => $path . $templatesPath, |
|
142 | - 'model' => $path . $modelsPath, |
|
143 | - 'public' => $path . $publicPath, |
|
141 | + 'template' => $path.$templatesPath, |
|
142 | + 'model' => $path.$modelsPath, |
|
143 | + 'public' => $path.$publicPath, |
|
144 | 144 | ]; |
145 | 145 | } |
146 | 146 | |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | foreach ($parameters as $param) { |
165 | 165 | if ($param->isOptional() && !is_array($param->getDefaultValue())) { |
166 | 166 | $params[$param->getName()] = $param->getDefaultValue(); |
167 | - $default = str_replace('{' . $param->getName() . '}', $param->getDefaultValue(), $regex); |
|
168 | - } elseif(!$param->isOptional()) { |
|
167 | + $default = str_replace('{'.$param->getName().'}', $param->getDefaultValue(), $regex); |
|
168 | + } elseif (!$param->isOptional()) { |
|
169 | 169 | $requirements[] = $param->getName(); |
170 | 170 | } |
171 | 171 | } |
172 | - } else { |
|
172 | + }else { |
|
173 | 173 | $default = $regex; |
174 | 174 | } |
175 | 175 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $httpMethod = self::extractReflectionHttpMethod($docComments); |
266 | 266 | $icon = self::extractDocIcon($docComments); |
267 | 267 | $label = self::extractReflectionLabel(str_replace('{__API__}', $api, $docComments)); |
268 | - $route = $httpMethod . "#|#" . $regex; |
|
268 | + $route = $httpMethod."#|#".$regex; |
|
269 | 269 | $route = preg_replace('/(\\r|\\f|\\t|\\n)/', '', $route); |
270 | 270 | $info = [ |
271 | 271 | 'method' => $method->getName(), |