@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | |
36 | 36 | public function get($value, $coulmn = 'id') |
37 | 37 | { |
38 | - return $this->where($coulmn . ' = ?' , $value)->fetch($this->table); |
|
38 | + return $this->where($coulmn . ' = ?', $value)->fetch($this->table); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function getEnable($value, $coulmn = 'id') |
42 | 42 | { |
43 | - return $this->where($coulmn . ' = ? AND enable = ?' , [$value, 1])->fetch($this->table); |
|
43 | + return $this->where($coulmn . ' = ? AND enable = ?', [$value, 1])->fetch($this->table); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public function selectTable($coulmn) |
@@ -50,23 +50,23 @@ discard block |
||
50 | 50 | |
51 | 51 | public function exists($value, $key = 'id') |
52 | 52 | { |
53 | - return (bool) $this->select($key)->where($key .'=?' , $value)->fetch($this->table); |
|
53 | + return (bool) $this->select($key)->where($key . '=?', $value)->fetch($this->table); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | public function delete($id) |
57 | 57 | { |
58 | - return $this->where('id = ?' , $id)->delete($this->table); |
|
58 | + return $this->where('id = ?', $id)->delete($this->table); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function hasOne($join, $id = null, $select = '*', $limit = null, $localId = null, $forginId = null) |
62 | 62 | { |
63 | 63 | $join = rtrim($join, 'Model'); |
64 | 64 | |
65 | - $file = $this->app->file->to( 'App/Models/' . $join . 'Model', '.php'); |
|
65 | + $file = $this->app->file->to('App/Models/' . $join . 'Model', '.php'); |
|
66 | 66 | |
67 | 67 | $exists = $this->app->file->exists($file); |
68 | 68 | |
69 | - if (! $exists) return $join . ' Not Found'; |
|
69 | + if (!$exists) return $join . ' Not Found'; |
|
70 | 70 | |
71 | 71 | $trace = debug_backtrace(); |
72 | 72 | |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | { |
82 | 82 | $join = rtrim($join, 'Model'); |
83 | 83 | |
84 | - $file = $this->app->file->to( 'App/Models/' . $join . 'Model', '.php'); |
|
84 | + $file = $this->app->file->to('App/Models/' . $join . 'Model', '.php'); |
|
85 | 85 | |
86 | 86 | $exists = $this->app->file->exists($file); |
87 | 87 | |
88 | - if (! $exists) return $join . ' Not Found'; |
|
88 | + if (!$exists) return $join . ' Not Found'; |
|
89 | 89 | |
90 | 90 | $trace = debug_backtrace(); |
91 | 91 | |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | { |
101 | 101 | $join = rtrim($join, 'Model'); |
102 | 102 | |
103 | - $file = $this->app->file->to( 'App/Models/' . $join . 'Model', '.php'); |
|
103 | + $file = $this->app->file->to('App/Models/' . $join . 'Model', '.php'); |
|
104 | 104 | |
105 | 105 | $exists = $this->app->file->exists($file); |
106 | 106 | |
107 | - if (! $exists) return $join . ' Not Found'; |
|
107 | + if (!$exists) return $join . ' Not Found'; |
|
108 | 108 | |
109 | 109 | $trace = debug_backtrace(); |
110 | 110 |
@@ -66,7 +66,9 @@ discard block |
||
66 | 66 | |
67 | 67 | $exists = $this->app->file->exists($file); |
68 | 68 | |
69 | - if (! $exists) return $join . ' Not Found'; |
|
69 | + if (! $exists) { |
|
70 | + return $join . ' Not Found'; |
|
71 | + } |
|
70 | 72 | |
71 | 73 | $trace = debug_backtrace(); |
72 | 74 | |
@@ -85,7 +87,9 @@ discard block |
||
85 | 87 | |
86 | 88 | $exists = $this->app->file->exists($file); |
87 | 89 | |
88 | - if (! $exists) return $join . ' Not Found'; |
|
90 | + if (! $exists) { |
|
91 | + return $join . ' Not Found'; |
|
92 | + } |
|
89 | 93 | |
90 | 94 | $trace = debug_backtrace(); |
91 | 95 | |
@@ -104,7 +108,9 @@ discard block |
||
104 | 108 | |
105 | 109 | $exists = $this->app->file->exists($file); |
106 | 110 | |
107 | - if (! $exists) return $join . ' Not Found'; |
|
111 | + if (! $exists) { |
|
112 | + return $join . ' Not Found'; |
|
113 | + } |
|
108 | 114 | |
109 | 115 | $trace = debug_backtrace(); |
110 | 116 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | //File Path |
31 | 31 | $file = str_replace('/', DS, $path); |
32 | - $file = $dir . DS . 'template' . DS . $file . '.pug'; |
|
32 | + $file = $dir . DS . 'template' . DS . $file . '.pug'; |
|
33 | 33 | |
34 | 34 | //Css Path |
35 | 35 | $css = $this->app->file->css(); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $this->app = $app; |
44 | 44 | |
45 | - if (! $this->isConnected()) { |
|
45 | + if (!$this->isConnected()) { |
|
46 | 46 | $this->connect(); |
47 | 47 | } |
48 | 48 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | extract($data); |
60 | 60 | |
61 | 61 | try { |
62 | - static::$connection = new PDO('mysql:host=' . $server . ';dbname=' . $dbname, $dbuser, $dbpass); |
|
62 | + static::$connection = new PDO('mysql:host=' . $server . ';dbname=' . $dbname, $dbuser, $dbpass); |
|
63 | 63 | |
64 | 64 | static::$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
65 | 65 | |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | |
96 | 96 | public function join($join, $localId = null, $forginId = null) |
97 | 97 | { |
98 | - if (! $localId) $localId = trim($join, 's' ). '_id'; |
|
98 | + if (!$localId) $localId = trim($join, 's') . '_id'; |
|
99 | 99 | |
100 | - if (! $forginId) $forginId = 'id'; |
|
100 | + if (!$forginId) $forginId = 'id'; |
|
101 | 101 | |
102 | 102 | $sql = $join . ' ON ' . $this->table . '.' . $localId . ' = ' . $join . '.' . $forginId; |
103 | 103 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | if ($this->orderBy) { |
220 | 220 | |
221 | - $sql .= ' ORDER BY ' . implode (' ', $this->orderBy); |
|
221 | + $sql .= ' ORDER BY ' . implode(' ', $this->orderBy); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | if ($this->limit) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | if ($this->groupBy) { |
235 | - $sql .= ' GROUP BY ' . implode(' ' , $this->groupBy); |
|
235 | + $sql .= ' GROUP BY ' . implode(' ', $this->groupBy); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | return $sql; |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | { |
325 | 325 | $sql = ''; |
326 | 326 | |
327 | - foreach($this->data as $key => $value) { |
|
327 | + foreach ($this->data as $key => $value) { |
|
328 | 328 | |
329 | 329 | $sql .= '`' . $key . '` = ? ,'; |
330 | 330 | } |
@@ -95,9 +95,13 @@ discard block |
||
95 | 95 | |
96 | 96 | public function join($join, $localId = null, $forginId = null) |
97 | 97 | { |
98 | - if (! $localId) $localId = trim($join, 's' ). '_id'; |
|
98 | + if (! $localId) { |
|
99 | + $localId = trim($join, 's' ). '_id'; |
|
100 | + } |
|
99 | 101 | |
100 | - if (! $forginId) $forginId = 'id'; |
|
102 | + if (! $forginId) { |
|
103 | + $forginId = 'id'; |
|
104 | + } |
|
101 | 105 | |
102 | 106 | $sql = $join . ' ON ' . $this->table . '.' . $localId . ' = ' . $join . '.' . $forginId; |
103 | 107 | |
@@ -110,7 +114,9 @@ discard block |
||
110 | 114 | { |
111 | 115 | $sql = array_shift($bindings); |
112 | 116 | |
113 | - if (is_array($bindings[0])) $bindings = $bindings[0]; |
|
117 | + if (is_array($bindings[0])) { |
|
118 | + $bindings = $bindings[0]; |
|
119 | + } |
|
114 | 120 | |
115 | 121 | $this->addToBindings($bindings); |
116 | 122 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | setcookie($key, $value, $expireTime, $this->path, '', false, true); |
23 | 23 | } |
24 | 24 | |
25 | - public function get($key , $default = null) |
|
25 | + public function get($key, $default = null) |
|
26 | 26 | { |
27 | 27 | return array_get($_COOKIE, $key, $default); |
28 | 28 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | if (strpos($requestUri, '?')) list($requestUri, $queryString) = explode('?', $requestUri); |
31 | 31 | |
32 | - if (! in_array($script, ['/', '\\'])) { |
|
32 | + if (!in_array($script, ['/', '\\'])) { |
|
33 | 33 | |
34 | 34 | $this->url = preg_replace('#^' . $script . '#', '', $requestUri); |
35 | 35 | } else { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $isSecure = true; |
47 | 47 | |
48 | 48 | } |
49 | - elseif (! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || ! empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { |
|
49 | + elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { |
|
50 | 50 | $isSecure = true; |
51 | 51 | } |
52 | 52 |
@@ -27,7 +27,9 @@ discard block |
||
27 | 27 | |
28 | 28 | $requestUri = $this->server('REQUEST_URI'); |
29 | 29 | |
30 | - if (strpos($requestUri, '?')) list($requestUri, $queryString) = explode('?', $requestUri); |
|
30 | + if (strpos($requestUri, '?')) { |
|
31 | + list($requestUri, $queryString) = explode('?', $requestUri); |
|
32 | + } |
|
31 | 33 | |
32 | 34 | if (! in_array($script, ['/', '\\'])) { |
33 | 35 | |
@@ -37,7 +39,9 @@ discard block |
||
37 | 39 | $this->url = $requestUri; |
38 | 40 | } |
39 | 41 | |
40 | - if ($this->url !== '/') $this->url = rtrim($this->url, '/'); |
|
42 | + if ($this->url !== '/') { |
|
43 | + $this->url = rtrim($this->url, '/'); |
|
44 | + } |
|
41 | 45 | |
42 | 46 | $isSecure = false; |
43 | 47 | |
@@ -45,8 +49,7 @@ discard block |
||
45 | 49 | |
46 | 50 | $isSecure = true; |
47 | 51 | |
48 | - } |
|
49 | - elseif (! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || ! empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { |
|
52 | + } elseif (! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || ! empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { |
|
50 | 53 | $isSecure = true; |
51 | 54 | } |
52 | 55 | |
@@ -101,7 +104,9 @@ discard block |
||
101 | 104 | |
102 | 105 | public function file($input) |
103 | 106 | { |
104 | - if (isset($this->files[$input])) return $this->files[$input]; |
|
107 | + if (isset($this->files[$input])) { |
|
108 | + return $this->files[$input]; |
|
109 | + } |
|
105 | 110 | |
106 | 111 | $upoadedFile = new UploadeFile($this->app, $input); |
107 | 112 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | public function sendHeaders() |
36 | 36 | { |
37 | - foreach($this->headers as $header => $value) |
|
37 | + foreach ($this->headers as $header => $value) |
|
38 | 38 | { |
39 | 39 | header($header . ':' . $value); |
40 | 40 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | public function exists() |
64 | 64 | { |
65 | - return ! empty($this->file); |
|
65 | + return !empty($this->file); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | public function getFileName() |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | $newName .= '.' . $this->extension; |
108 | 108 | |
109 | - if (! is_dir($target)) mkdir($target, 0777, true); |
|
109 | + if (!is_dir($target)) mkdir($target, 0777, true); |
|
110 | 110 | |
111 | 111 | $filePath = $target . $newName; |
112 | 112 |
@@ -35,13 +35,17 @@ discard block |
||
35 | 35 | |
36 | 36 | private function getFileInfo($input) |
37 | 37 | { |
38 | - if (empty($_FILES[$input])) return; |
|
38 | + if (empty($_FILES[$input])) { |
|
39 | + return; |
|
40 | + } |
|
39 | 41 | |
40 | 42 | $file = $_FILES[$input]; |
41 | 43 | |
42 | 44 | $this->error = $file['error']; |
43 | 45 | |
44 | - if ($this->error != UPLOAD_ERR_OK) return; |
|
46 | + if ($this->error != UPLOAD_ERR_OK) { |
|
47 | + return; |
|
48 | + } |
|
45 | 49 | |
46 | 50 | $this->file = $file; |
47 | 51 | |
@@ -106,7 +110,9 @@ discard block |
||
106 | 110 | |
107 | 111 | $newName .= '.' . $this->extension; |
108 | 112 | |
109 | - if (! is_dir($target)) mkdir($target, 0777, true); |
|
113 | + if (! is_dir($target)) { |
|
114 | + mkdir($target, 0777, true); |
|
115 | + } |
|
110 | 116 | |
111 | 117 | $filePath = $target . $newName; |
112 | 118 |
@@ -92,7 +92,7 @@ |
||
92 | 92 | |
93 | 93 | public function get($key) |
94 | 94 | { |
95 | - if (! $this->isSharing($key)) { |
|
95 | + if (!$this->isSharing($key)) { |
|
96 | 96 | if ($this->isCoreAlias($key)) { |
97 | 97 | |
98 | 98 | $this->share($key, $this->createObject($key)); |
@@ -59,7 +59,9 @@ |
||
59 | 59 | |
60 | 60 | $this->file->call($this->file->to('config/constant.php')); |
61 | 61 | |
62 | - foreach (glob("routes/*.php") AS $route) $this->file->call($this->file->to($route)); |
|
62 | + foreach (glob("routes/*.php") AS $route) { |
|
63 | + $this->file->call($this->file->to($route)); |
|
64 | + } |
|
63 | 65 | |
64 | 66 | $output = $this->route->getProperRoute(); |
65 | 67 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $controller = $this->getControllerName($controller); |
32 | 32 | |
33 | - if (! $this->hasController($controller)) { |
|
33 | + if (!$this->hasController($controller)) { |
|
34 | 34 | $this->addController($controller); |
35 | 35 | } |
36 | 36 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $controller = str_replace('/', DS, $controller); |
62 | 62 | |
63 | - $controller = 'App' . DS .'Controllers' . DS . $controller; |
|
63 | + $controller = 'App' . DS . 'Controllers' . DS . $controller; |
|
64 | 64 | |
65 | 65 | return $controller; |
66 | 66 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $model = $this->getModelName($model); |
71 | 71 | |
72 | - if (! $this->hasModel($model)) { |
|
72 | + if (!$this->hasModel($model)) { |
|
73 | 73 | $this->addModel($model); |
74 | 74 | } |
75 | 75 |