@@ -53,7 +53,7 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | - * @return bool|int |
|
56 | + * @return integer |
|
57 | 57 | * @throws Exception |
58 | 58 | */ |
59 | 59 | public function getID() |
@@ -50,7 +50,7 @@ |
||
50 | 50 | * |
51 | 51 | * @param string $dbName Database name |
52 | 52 | * |
53 | - * @return boolean |
|
53 | + * @return boolean|null |
|
54 | 54 | * @throws \InvalidArgumentException |
55 | 55 | */ |
56 | 56 | public function switchDatabase($dbName) |
@@ -20,7 +20,7 @@ |
||
20 | 20 | class ResolverInjector extends Injector |
21 | 21 | { |
22 | 22 | /** |
23 | - * @return bool |
|
23 | + * @return IResolver |
|
24 | 24 | * @throws Exception |
25 | 25 | */ |
26 | 26 | public function build() |
@@ -20,7 +20,7 @@ |
||
20 | 20 | class ResolverInjector extends Injector |
21 | 21 | { |
22 | 22 | /** |
23 | - * @return bool |
|
23 | + * @return IResolver |
|
24 | 24 | * @throws Exception |
25 | 25 | */ |
26 | 26 | public function build() |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public static function finder(IQuery $query = null, $single = false) |
108 | 108 | { |
109 | 109 | $query = ($query instanceof Query) ? $query : new Query((new ConnectionInjector)->build()); |
110 | - $query->table = static::$tableName . ' m'; |
|
110 | + $query->table = static::$tableName.' m'; |
|
111 | 111 | $query->objectName = get_called_class(); |
112 | 112 | $query->single = $single; |
113 | 113 | |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | $sql = new Query((new ConnectionInjector)->build()); |
166 | 166 | |
167 | 167 | if ((new ConnectionInjector)->build()->getDriverType() === 'pgsql') { |
168 | - $sql->addWhere('"m"."' . $relation['On'][1] . '"=:' . $relation['On'][0]); |
|
168 | + $sql->addWhere('"m"."'.$relation['On'][1].'"=:'.$relation['On'][0]); |
|
169 | 169 | } else { |
170 | - $sql->addWhere('`m`.`' . $relation['On'][1] . '`=:' . $relation['On'][0]); |
|
170 | + $sql->addWhere('`m`.`'.$relation['On'][1].'`=:'.$relation['On'][0]); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | if ($relation['Where']) { |
@@ -380,9 +380,9 @@ discard block |
||
380 | 380 | if (!$where) { |
381 | 381 | if (self::$primaryKey) { |
382 | 382 | if ((new ConnectionInjector)->build()->getDriverType() === 'pgsql') { |
383 | - $where .= '"' . self::$primaryKey . '" = :' . self::$primaryKey; |
|
383 | + $where .= '"'.self::$primaryKey.'" = :'.self::$primaryKey; |
|
384 | 384 | } else { |
385 | - $where .= '`' . self::$primaryKey . '` = :' . self::$primaryKey; |
|
385 | + $where .= '`'.self::$primaryKey.'` = :'.self::$primaryKey; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | } else { |
@@ -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 | } |