@@ -98,7 +98,9 @@ |
||
| 98 | 98 | */ |
| 99 | 99 | public function destroy() |
| 100 | 100 | { |
| 101 | - foreach (array_keys($this->all()) as $key) $this->remove($key); |
|
| 101 | + foreach (array_keys($this->all()) as $key) { |
|
| 102 | + $this->remove($key); |
|
| 103 | + } |
|
| 102 | 104 | unset($_COOKIE); |
| 103 | 105 | } |
| 104 | 106 | } |
@@ -120,17 +120,17 @@ |
||
| 120 | 120 | */ |
| 121 | 121 | private function parameters() |
| 122 | 122 | { |
| 123 | - $url = $this->app->request->url(); |
|
| 123 | + $url = $this->app->request->url(); |
|
| 124 | 124 | |
| 125 | - if ($url === '/') {return;} |
|
| 126 | - $parameters = explode('/', $url); |
|
| 125 | + if ($url === '/') {return; } |
|
| 126 | + $parameters = explode('/', $url); |
|
| 127 | 127 | array_shift($parameters); |
| 128 | 128 | $return = []; |
| 129 | 129 | |
| 130 | 130 | foreach ($parameters as $parameter) { |
| 131 | 131 | $name = $parameter; |
| 132 | - $length = strpos($url, $parameter) + strlen($parameter); |
|
| 133 | - $link = substr($url, 0, $length); |
|
| 132 | + $length = strpos($url, $parameter) + strlen($parameter); |
|
| 133 | + $link = substr($url, 0, $length); |
|
| 134 | 134 | |
| 135 | 135 | $return[] = [ |
| 136 | 136 | 'name' => $name, |
@@ -103,7 +103,9 @@ |
||
| 103 | 103 | $public = assets(); |
| 104 | 104 | $public = str_replace($dir, $host, $public); |
| 105 | 105 | $public = str_replace('\\', '/', $public); |
| 106 | - if (substr($public, -1) !== '/') $public = $public . '/'; |
|
| 106 | + if (substr($public, -1) !== '/') { |
|
| 107 | + $public = $public . '/'; |
|
| 108 | + } |
|
| 107 | 109 | |
| 108 | 110 | return $public; |
| 109 | 111 | } |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | return $this->container[$path . ':content']; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - /** |
|
| 116 | + /** |
|
| 117 | 117 | * Generate full path to the given path |
| 118 | 118 | * |
| 119 | 119 | * @param string $path |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | ini_set('session.use_only_cookies', 1); |
| 30 | 30 | |
| 31 | - if (! session_id()) session_start(); |
|
| 31 | + if (!session_id()) session_start(); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param mixed $default |
| 51 | 51 | * @return mixed |
| 52 | 52 | */ |
| 53 | - public function get($key , $default = null) |
|
| 53 | + public function get($key, $default = null) |
|
| 54 | 54 | { |
| 55 | 55 | return array_get($_SESSION, $key, $default); |
| 56 | 56 | } |
@@ -28,7 +28,9 @@ |
||
| 28 | 28 | { |
| 29 | 29 | ini_set('session.use_only_cookies', 1); |
| 30 | 30 | |
| 31 | - if (! session_id()) session_start(); |
|
| 31 | + if (! session_id()) { |
|
| 32 | + session_start(); |
|
| 33 | + } |
|
| 32 | 34 | } |
| 33 | 35 | |
| 34 | 36 | /** |
@@ -38,7 +38,9 @@ discard block |
||
| 38 | 38 | public function add($name, $link, $icon = null) |
| 39 | 39 | { |
| 40 | 40 | if (!$this->title) { |
| 41 | - if (!$icon) $icon = 'icon-star'; |
|
| 41 | + if (!$icon) { |
|
| 42 | + $icon = 'icon-star'; |
|
| 43 | + } |
|
| 42 | 44 | |
| 43 | 45 | $this->pages[] = [ |
| 44 | 46 | 'name' => $name, |
@@ -46,7 +48,9 @@ discard block |
||
| 46 | 48 | 'icon' => $icon |
| 47 | 49 | ]; |
| 48 | 50 | } else { |
| 49 | - if (!$icon) $icon = $this->icon; |
|
| 51 | + if (!$icon) { |
|
| 52 | + $icon = $this->icon; |
|
| 53 | + } |
|
| 50 | 54 | |
| 51 | 55 | $page = [ |
| 52 | 56 | 'name' => $name, |
@@ -70,7 +74,9 @@ discard block |
||
| 70 | 74 | { |
| 71 | 75 | $this->title = $options['title']; |
| 72 | 76 | |
| 73 | - if (!$options['icon']) $options['icon'] = 'icon-star'; |
|
| 77 | + if (!$options['icon']) { |
|
| 78 | + $options['icon'] = 'icon-star'; |
|
| 79 | + } |
|
| 74 | 80 | |
| 75 | 81 | $this->icon = $options['icon']; |
| 76 | 82 | |
@@ -117,7 +117,7 @@ |
||
| 117 | 117 | $this->container[$key] = $value; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - /** |
|
| 120 | + /** |
|
| 121 | 121 | * Get shared value |
| 122 | 122 | * |
| 123 | 123 | * @param string $key |
@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $this->share('file', $file); |
| 36 | 36 | |
| 37 | - if ($this->file->call('config/error.php')) $this->handleErrors(); |
|
| 37 | + if ($this->file->call('config/error.php')) { |
|
| 38 | + $this->handleErrors(); |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | 41 | $this->file->call('Core/helpers.php'); |
| 40 | 42 | } |
@@ -85,7 +87,9 @@ discard block |
||
| 85 | 87 | |
| 86 | 88 | $this->request->prepareUrl(); |
| 87 | 89 | |
| 88 | - foreach (glob("routes/**/*.php") as $route) $this->file->call($route); |
|
| 90 | + foreach (glob("routes/**/*.php") as $route) { |
|
| 91 | + $this->file->call($route); |
|
| 92 | + } |
|
| 89 | 93 | |
| 90 | 94 | $output = $this->route->getProperRoute(); |
| 91 | 95 | |
@@ -113,7 +117,9 @@ discard block |
||
| 113 | 117 | */ |
| 114 | 118 | public function share($key, $value) |
| 115 | 119 | { |
| 116 | - if ($value instanceof Closure) $value = call_user_func($value, $this); |
|
| 120 | + if ($value instanceof Closure) { |
|
| 121 | + $value = call_user_func($value, $this); |
|
| 122 | + } |
|
| 117 | 123 | $this->container[$key] = $value; |
| 118 | 124 | } |
| 119 | 125 | |
@@ -56,14 +56,18 @@ |
||
| 56 | 56 | |
| 57 | 57 | private function setAction($action) |
| 58 | 58 | { |
| 59 | - if ($this->basController) $action = $this->basController . '/' . $action; |
|
| 59 | + if ($this->basController) { |
|
| 60 | + $action = $this->basController . '/' . $action; |
|
| 61 | + } |
|
| 60 | 62 | |
| 61 | 63 | return $action; |
| 62 | 64 | } |
| 63 | 65 | |
| 64 | 66 | private function setMiddleware($middleware) |
| 65 | 67 | { |
| 66 | - if (!is_array($middleware)) $middleware = [$middleware]; |
|
| 68 | + if (!is_array($middleware)) { |
|
| 69 | + $middleware = [$middleware]; |
|
| 70 | + } |
|
| 67 | 71 | $middleware = array_merge($this->groupMiddleware, $middleware); |
| 68 | 72 | return $middleware; |
| 69 | 73 | } |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | { |
| 93 | 93 | $args = func_get_args()[0]; |
| 94 | 94 | |
| 95 | - foreach($args as $join) { |
|
| 95 | + foreach ($args as $join) { |
|
| 96 | 96 | $sql[] = $join[0] . ' ON ' . $this->table . '.' . $join[1] . ' = ' . $join[0] . '.' . $join[2]; |
| 97 | 97 | } |
| 98 | 98 | $this->joins = $sql; |
@@ -42,7 +42,9 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $this->app = $app; |
| 44 | 44 | |
| 45 | - if (!$this->isConnected()) $this->connect(); |
|
| 45 | + if (!$this->isConnected()) { |
|
| 46 | + $this->connect(); |
|
| 47 | + } |
|
| 46 | 48 | } |
| 47 | 49 | |
| 48 | 50 | private function isConnected() |
@@ -104,7 +106,9 @@ discard block |
||
| 104 | 106 | { |
| 105 | 107 | $sql = array_shift($bindings); |
| 106 | 108 | |
| 107 | - if (is_array($bindings[0])) $bindings = $bindings[0]; |
|
| 109 | + if (is_array($bindings[0])) { |
|
| 110 | + $bindings = $bindings[0]; |
|
| 111 | + } |
|
| 108 | 112 | |
| 109 | 113 | $this->addToBindings($bindings); |
| 110 | 114 | |
@@ -156,7 +160,9 @@ discard block |
||
| 156 | 160 | |
| 157 | 161 | public function fetch($table = null) |
| 158 | 162 | { |
| 159 | - if ($table) $this->table($table); |
|
| 163 | + if ($table) { |
|
| 164 | + $this->table($table); |
|
| 165 | + } |
|
| 160 | 166 | |
| 161 | 167 | $sql = $this->fetchStatment(); |
| 162 | 168 | |
@@ -173,7 +179,9 @@ discard block |
||
| 173 | 179 | |
| 174 | 180 | public function fetchAll($table = null) |
| 175 | 181 | { |
| 176 | - if ($table) $this->table($table); |
|
| 182 | + if ($table) { |
|
| 183 | + $this->table($table); |
|
| 184 | + } |
|
| 177 | 185 | |
| 178 | 186 | $sql = $this->fetchStatment(); |
| 179 | 187 | |
@@ -197,7 +205,9 @@ discard block |
||
| 197 | 205 | $sql .= ' FROM ' . $this->table . ' '; |
| 198 | 206 | |
| 199 | 207 | if (!empty($this->joins)) { |
| 200 | - foreach ($this->joins as $join) $sql .= 'LEFT JOIN ' . $join . ' '; |
|
| 208 | + foreach ($this->joins as $join) { |
|
| 209 | + $sql .= 'LEFT JOIN ' . $join . ' '; |
|
| 210 | + } |
|
| 201 | 211 | } |
| 202 | 212 | |
| 203 | 213 | if (!empty($this->wheres)) { |
@@ -258,7 +268,9 @@ discard block |
||
| 258 | 268 | |
| 259 | 269 | public function insert($table = null) |
| 260 | 270 | { |
| 261 | - if ($table) $this->table($table); |
|
| 271 | + if ($table) { |
|
| 272 | + $this->table($table); |
|
| 273 | + } |
|
| 262 | 274 | |
| 263 | 275 | $sql = 'INSERT INTO ' . $this->table . ' SET '; |
| 264 | 276 | |
@@ -273,13 +285,17 @@ discard block |
||
| 273 | 285 | |
| 274 | 286 | public function update($table = null) |
| 275 | 287 | { |
| 276 | - if ($table) $this->table($table); |
|
| 288 | + if ($table) { |
|
| 289 | + $this->table($table); |
|
| 290 | + } |
|
| 277 | 291 | |
| 278 | 292 | $sql = 'UPDATE ' . $this->table . ' SET '; |
| 279 | 293 | |
| 280 | 294 | $sql .= $this->setField(); |
| 281 | 295 | |
| 282 | - if (!empty($this->wheres)) $sql .= ' WHERE ' . implode('', $this->wheres); |
|
| 296 | + if (!empty($this->wheres)) { |
|
| 297 | + $sql .= ' WHERE ' . implode('', $this->wheres); |
|
| 298 | + } |
|
| 283 | 299 | |
| 284 | 300 | $this->query($sql, $this->bindings); |
| 285 | 301 | |
@@ -288,11 +304,15 @@ discard block |
||
| 288 | 304 | |
| 289 | 305 | public function delete($table = null) |
| 290 | 306 | { |
| 291 | - if ($table) $this->table($table); |
|
| 307 | + if ($table) { |
|
| 308 | + $this->table($table); |
|
| 309 | + } |
|
| 292 | 310 | |
| 293 | 311 | $sql = 'DELETE FROM ' . $this->table . ' '; |
| 294 | 312 | |
| 295 | - if (!empty($this->wheres)) $sql .= ' WHERE ' . implode('', $this->wheres); |
|
| 313 | + if (!empty($this->wheres)) { |
|
| 314 | + $sql .= ' WHERE ' . implode('', $this->wheres); |
|
| 315 | + } |
|
| 296 | 316 | |
| 297 | 317 | $this->query($sql, $this->bindings); |
| 298 | 318 | |
@@ -303,7 +323,9 @@ discard block |
||
| 303 | 323 | { |
| 304 | 324 | $sql = ''; |
| 305 | 325 | |
| 306 | - foreach ($this->data as $key => $value) $sql .= '`' . $key . '` = ? ,'; |
|
| 326 | + foreach ($this->data as $key => $value) { |
|
| 327 | + $sql .= '`' . $key . '` = ? ,'; |
|
| 328 | + } |
|
| 307 | 329 | |
| 308 | 330 | $sql = rtrim($sql, ' ,'); |
| 309 | 331 | |
@@ -323,7 +345,9 @@ discard block |
||
| 323 | 345 | { |
| 324 | 346 | $sql = array_shift($bindings); |
| 325 | 347 | |
| 326 | - if (count($bindings) == 1 and is_array($bindings[0])) $bindings = $bindings[0]; |
|
| 348 | + if (count($bindings) == 1 and is_array($bindings[0])) { |
|
| 349 | + $bindings = $bindings[0]; |
|
| 350 | + } |
|
| 327 | 351 | |
| 328 | 352 | try { |
| 329 | 353 | $query = $this->connection()->prepare($sql); |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | * |
| 10 | 10 | * @var \System\Application |
| 11 | 11 | */ |
| 12 | - protected $app; |
|
| 12 | + protected $app; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * Constructor |