@@ -88,7 +88,7 @@ |
||
88 | 88 | * @param string $path path to redirect |
89 | 89 | * @param integer $status status for redirect |
90 | 90 | * |
91 | - * @return bool|ResponseInterface |
|
91 | + * @return string|false |
|
92 | 92 | * @throws Exception|\InvalidArgumentException |
93 | 93 | */ |
94 | 94 | public function redirect($path, $status = 301) |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $actionClass = $this->getActionClassByName($name); |
44 | 44 | |
45 | 45 | if (!$actionClass) { |
46 | - throw new Exception('Action `' . $name . '` not found into ' . get_class($this)); |
|
46 | + throw new Exception('Action `'.$name.'` not found into '.get_class($this)); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | $response = $response->withStatus($status); |
104 | - $response = $response->getHeaderLine('Location: ' . $path); |
|
104 | + $response = $response->getHeaderLine('Location: '.$path); |
|
105 | 105 | |
106 | 106 | return $response; |
107 | 107 | } |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | $actionClass = false; |
59 | 59 | |
60 | 60 | // check action exists |
61 | - if (!method_exists($this, 'action' . ucfirst($name)) && !$actionClass = $this->getActionClassByName($name)) { |
|
62 | - return $this->response->withStatus(500, 'Action `' . $name . '` not found into ' . get_class($this)); |
|
61 | + if (!method_exists($this, 'action'.ucfirst($name)) && !$actionClass = $this->getActionClassByName($name)) { |
|
62 | + return $this->response->withStatus(500, 'Action `'.$name.'` not found into '.get_class($this)); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | $types = $this->actionsTypes(); |
66 | 66 | |
67 | 67 | if (!empty($types[$name]) && $this->methodType !== $types[$name]) { |
68 | 68 | return $this->response->withStatus(500, |
69 | - 'Action `' . $name . '` not run with method `' . $this->methodType . '` into ' . get_class($this) |
|
69 | + 'Action `'.$name.'` not run with method `'.$this->methodType.'` into '.get_class($this) |
|
70 | 70 | ); |
71 | 71 | } |
72 | 72 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $cl = new $actionClass(); |
80 | 80 | $view = $cl->run(); |
81 | 81 | } else { |
82 | - $view = $this->{'action' . ucfirst($name)}(); |
|
82 | + $view = $this->{'action'.ucfirst($name)}(); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $this->response = $this->response->withHeader('Content-Type', $this->format); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $cls = $this->getCalculatePath(); |
63 | 63 | |
64 | 64 | if (!class_exists($cls) || !is_subclass_of($cls, '\Micro\Mvc\Controllers\IController')) { |
65 | - throw new Exception('Controller ' . $cls . ' not found or not a valid'); |
|
65 | + throw new Exception('Controller '.$cls.' not found or not a valid'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | return new $cls($this->getModules()); |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | protected function prepareExtensions(&$uriBlocks) |
123 | 123 | { |
124 | 124 | foreach ($uriBlocks as $i => $block) { |
125 | - if (file_exists((new KernelInjector)->build()->getAppDir() . $this->extensions . '/extensions/' . $block)) { |
|
126 | - $this->extensions .= '/Extensions/' . ucfirst($block); |
|
125 | + if (file_exists((new KernelInjector)->build()->getAppDir().$this->extensions.'/extensions/'.$block)) { |
|
126 | + $this->extensions .= '/Extensions/'.ucfirst($block); |
|
127 | 127 | |
128 | 128 | unset($uriBlocks[$i]); |
129 | 129 | } else { |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | */ |
149 | 149 | protected function prepareModules(&$uriBlocks) |
150 | 150 | { |
151 | - $path = (new KernelInjector)->build()->getAppDir() . ($this->extensions ?: ''); |
|
151 | + $path = (new KernelInjector)->build()->getAppDir().($this->extensions ?: ''); |
|
152 | 152 | |
153 | 153 | foreach ($uriBlocks as $i => $block) { |
154 | - if ($block && file_exists($path . strtolower($this->modules) . '/modules/' . $block)) { |
|
155 | - $this->modules .= '/Modules/' . ucfirst($block); |
|
154 | + if ($block && file_exists($path.strtolower($this->modules).'/modules/'.$block)) { |
|
155 | + $this->modules .= '/Modules/'.ucfirst($block); |
|
156 | 156 | |
157 | 157 | unset($uriBlocks[$i]); |
158 | 158 | } else { |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | */ |
176 | 176 | protected function prepareController(&$uriBlocks) |
177 | 177 | { |
178 | - $path = (new KernelInjector)->build()->getAppDir() . ($this->extensions ?: '') . strtolower($this->modules ?: ''); |
|
178 | + $path = (new KernelInjector)->build()->getAppDir().($this->extensions ?: '').strtolower($this->modules ?: ''); |
|
179 | 179 | $str = array_shift($uriBlocks); |
180 | 180 | |
181 | - if (file_exists(str_replace('\\', '/', $path . '/controllers/' . ucfirst($str) . 'Controller.php'))) { |
|
181 | + if (file_exists(str_replace('\\', '/', $path.'/controllers/'.ucfirst($str).'Controller.php'))) { |
|
182 | 182 | $this->controller = $str; |
183 | 183 | } else { |
184 | 184 | $this->controller = 'default'; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function getCalculatePath() |
213 | 213 | { |
214 | - return '\\App' . $this->getExtensions() . $this->getModules() . '\\Controllers\\' . $this->getController(); |
|
214 | + return '\\App'.$this->getExtensions().$this->getModules().'\\Controllers\\'.$this->getController(); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function getController() |
249 | 249 | { |
250 | - return ucfirst($this->controller) . 'Controller'; |
|
250 | + return ucfirst($this->controller).'Controller'; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 |
@@ -38,17 +38,17 @@ |
||
38 | 38 | if (!empty($this->params['types']) && (strpos($this->params['types'], |
39 | 39 | $fContext->getClientMediaType()) === false) |
40 | 40 | ) { |
41 | - $this->errors[] = 'File ' . $fContext->getClientFilename() . ' not allowed type'; |
|
41 | + $this->errors[] = 'File '.$fContext->getClientFilename().' not allowed type'; |
|
42 | 42 | |
43 | 43 | return false; |
44 | 44 | } |
45 | 45 | if (!empty($this->params['minSize']) && ($fContext->getSize() < $this->params['minSize'])) { |
46 | - $this->errors[] = 'File ' . $fContext->getClientFilename() . ' too small size'; |
|
46 | + $this->errors[] = 'File '.$fContext->getClientFilename().' too small size'; |
|
47 | 47 | |
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | if (!empty($this->params['maxSize']) && ($fContext->getSize() > $this->params['maxSize'])) { |
51 | - $this->errors[] = 'File ' . $fContext->getClientFilename() . ' too many size'; |
|
51 | + $this->errors[] = 'File '.$fContext->getClientFilename().' too many size'; |
|
52 | 52 | |
53 | 53 | return false; |
54 | 54 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | if (!$this->loaded) { |
143 | 143 | $this->initialize($request); |
144 | 144 | |
145 | - $this->addListener('kernel.kill', function () use ($isAjax) { |
|
145 | + $this->addListener('kernel.kill', function() use ($isAjax) { |
|
146 | 146 | if ($this->isDebug() && !$this->isCli() && !$isAjax) { |
147 | 147 | echo '<div class="debug_timer">', (microtime(true) - $this->getStartTime()), '</div>'; |
148 | 148 | } |
@@ -467,13 +467,13 @@ discard block |
||
467 | 467 | public function send(ResponseInterface $response) |
468 | 468 | { |
469 | 469 | header( |
470 | - 'HTTP/' . $response->getProtocolVersion() . ' ' . |
|
471 | - $response->getStatusCode() . ' ' . |
|
470 | + 'HTTP/'.$response->getProtocolVersion().' '. |
|
471 | + $response->getStatusCode().' '. |
|
472 | 472 | $response->getReasonPhrase() |
473 | 473 | ); |
474 | 474 | |
475 | 475 | foreach ($response->getHeaders() as $header => $values) { |
476 | - header($header . ': ' . implode(', ', $values)); |
|
476 | + header($header.': '.implode(', ', $values)); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | printf($response->getBody()); |