Passed
Branch master (3058e5)
by refat
06:27 queued 01:27
created
Core/System/Url.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -4,31 +4,31 @@
 block discarded – undo
4 4
 
5 5
 class Url
6 6
 {
7
-  protected $app;
7
+	protected $app;
8 8
 
9
-  public function __construct(Application $app)
10
-  {
11
-    $this->app = $app;
12
-  }
9
+	public function __construct(Application $app)
10
+	{
11
+		$this->app = $app;
12
+	}
13 13
 
14
-  public function link($path)
15
-  {
16
-    $link = $this->app->request->link();
14
+	public function link($path)
15
+	{
16
+		$link = $this->app->request->link();
17 17
 
18
-    $path = rtrim($path, '/');
19
-    $path = ltrim($path, '/');
18
+		$path = rtrim($path, '/');
19
+		$path = ltrim($path, '/');
20 20
 
21
-    return $link . '/' . $path;
22
-  }
21
+		return $link . '/' . $path;
22
+	}
23 23
 
24
-  public function redirectTo($path, $num = 0)
25
-  {
26
-    if ($path == 'error') {
24
+	public function redirectTo($path, $num = 0)
25
+	{
26
+		if ($path == 'error') {
27 27
 
28
-      $this->app->session->set('error', true);
29
-    }
28
+			$this->app->session->set('error', true);
29
+		}
30 30
 
31
-    header('Refresh: ' . $num . '; URL=' . $this->link($path));
32
-    exit;
33
-  }
31
+		header('Refresh: ' . $num . '; URL=' . $this->link($path));
32
+		exit;
33
+	}
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
Core/System/Http/Request.php 2 patches
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -6,144 +6,144 @@
 block discarded – undo
6 6
 
7 7
 class Request
8 8
 {
9
-  private $app;
9
+	private $app;
10 10
 
11
-  private $url;
11
+	private $url;
12 12
 
13
-  private $baseUrl;
13
+	private $baseUrl;
14 14
 
15
-  private $files = [];
15
+	private $files = [];
16 16
 
17
-  private $link;
17
+	private $link;
18 18
 
19
-  public function __construct(Application $app)
20
-  {
21
-    $this->app = $app;
22
-  }
19
+	public function __construct(Application $app)
20
+	{
21
+		$this->app = $app;
22
+	}
23 23
 
24
-  public function prepareUrl()
25
-  {
26
-    $script = dirname($this->server('SCRIPT_NAME'));
24
+	public function prepareUrl()
25
+	{
26
+		$script = dirname($this->server('SCRIPT_NAME'));
27 27
 
28
-    $requestUri = $this->server('REQUEST_URI');
28
+		$requestUri = $this->server('REQUEST_URI');
29 29
 
30
-    if (strpos($requestUri, '?')) {
30
+		if (strpos($requestUri, '?')) {
31 31
 
32
-      list($requestUri, $queryString) = explode('?', $requestUri);
33
-    }
32
+			list($requestUri, $queryString) = explode('?', $requestUri);
33
+		}
34 34
 
35
-    if (! in_array($script, ['/', '\\'])) {
35
+		if (! in_array($script, ['/', '\\'])) {
36 36
 
37
-      $this->url = preg_replace('#^' . $script . '#', '', $requestUri);
38
-    } else {
37
+			$this->url = preg_replace('#^' . $script . '#', '', $requestUri);
38
+		} else {
39 39
 
40
-      $this->url = $requestUri;
41
-    }
40
+			$this->url = $requestUri;
41
+		}
42 42
 
43
-    if ($this->url !== '/') {
43
+		if ($this->url !== '/') {
44 44
 
45
-      $this->url = rtrim($this->url, '/');
46
-    }
45
+			$this->url = rtrim($this->url, '/');
46
+		}
47 47
 
48
-    $isSecure = false;
48
+		$isSecure = false;
49 49
 
50
-    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
50
+		if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
51 51
 
52
-      $isSecure = true;
52
+			$isSecure = true;
53 53
 
54
-    } 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')) {
55
-      $isSecure = true;
56
-    }
54
+		} 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')) {
55
+			$isSecure = true;
56
+		}
57 57
 
58
-    $REQUEST_PROTOCOL = $isSecure ? 'https' : 'http';
58
+		$REQUEST_PROTOCOL = $isSecure ? 'https' : 'http';
59 59
 
60
-    $this->link = $REQUEST_PROTOCOL . '://' . $this->server('HTTP_HOST');
60
+		$this->link = $REQUEST_PROTOCOL . '://' . $this->server('HTTP_HOST');
61 61
 
62
-    $this->baseUrl = $this->link . $requestUri;
63
-  }
62
+		$this->baseUrl = $this->link . $requestUri;
63
+	}
64 64
 
65
-  public function get($key)
66
-  {
67
-    $value = array_get($_GET, $key);
65
+	public function get($key)
66
+	{
67
+		$value = array_get($_GET, $key);
68 68
 
69
-    if (is_array($value)) {
70
-      $value = array_filter($value);
71
-    } else {
72
-      $value = trim($value);
73
-    }
69
+		if (is_array($value)) {
70
+			$value = array_filter($value);
71
+		} else {
72
+			$value = trim($value);
73
+		}
74 74
 
75
-    return $value;
76
-  }
75
+		return $value;
76
+	}
77 77
 
78
-  public function post($key)
79
-  {
80
-    $value = array_get($_POST, $key);
78
+	public function post($key)
79
+	{
80
+		$value = array_get($_POST, $key);
81 81
 
82
-    if (is_array($value)) {
83
-      $value = array_filter($value);
84
-    } else {
85
-      $value = trim($value);
86
-    }
82
+		if (is_array($value)) {
83
+			$value = array_filter($value);
84
+		} else {
85
+			$value = trim($value);
86
+		}
87 87
 
88
-    return $value;
89
-  }
88
+		return $value;
89
+	}
90 90
 
91
-  public function setPost($key, $value)
92
-  {
93
-    $_POST[$key] = $value;
94
-  }
91
+	public function setPost($key, $value)
92
+	{
93
+		$_POST[$key] = $value;
94
+	}
95 95
 
96
-  public function posts()
97
-  {
98
-    return $_POST;
99
-  }
96
+	public function posts()
97
+	{
98
+		return $_POST;
99
+	}
100 100
 
101
-  public function files()
102
-  {
103
-    return $_FILES;
104
-  }
101
+	public function files()
102
+	{
103
+		return $_FILES;
104
+	}
105 105
 
106
-  public function file($input)
107
-  {
108
-    if (isset($this->files[$input])) {
106
+	public function file($input)
107
+	{
108
+		if (isset($this->files[$input])) {
109 109
 
110
-      return $this->files[$input];
111
-    }
110
+			return $this->files[$input];
111
+		}
112 112
 
113
-    $upoadedFile = new UploadeFile($this->app, $input);
113
+		$upoadedFile = new UploadeFile($this->app, $input);
114 114
 
115
-    $this->files[$input] = $upoadedFile;
115
+		$this->files[$input] = $upoadedFile;
116 116
 
117
-    return $this->files[$input];
118
-  }
117
+		return $this->files[$input];
118
+	}
119 119
 
120
-  public function server($key)
121
-  {
122
-    return array_get($_SERVER, $key);
123
-  }
120
+	public function server($key)
121
+	{
122
+		return array_get($_SERVER, $key);
123
+	}
124 124
 
125
-  public function method()
126
-  {
127
-    return $this->server('REQUEST_METHOD');
128
-  }
125
+	public function method()
126
+	{
127
+		return $this->server('REQUEST_METHOD');
128
+	}
129 129
 
130
-  public function referer()
131
-  {
132
-    return $this->server('HTTP_REFERER');
133
-  }
130
+	public function referer()
131
+	{
132
+		return $this->server('HTTP_REFERER');
133
+	}
134 134
 
135
-  public function baseUrl()
136
-  {
137
-    return $this->baseUrl;
138
-  }
135
+	public function baseUrl()
136
+	{
137
+		return $this->baseUrl;
138
+	}
139 139
 
140
-  public function url()
141
-  {
142
-    return $this->url;
143
-  }
140
+	public function url()
141
+	{
142
+		return $this->url;
143
+	}
144 144
 
145
-  public function link()
146
-  {
147
-    return $this->link;
148
-  }
145
+	public function link()
146
+	{
147
+		return $this->link;
148
+	}
149 149
 }
150 150
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
       list($requestUri, $queryString) = explode('?', $requestUri);
33 33
     }
34 34
 
35
-    if (! in_array($script, ['/', '\\'])) {
35
+    if (!in_array($script, ['/', '\\'])) {
36 36
 
37 37
       $this->url = preg_replace('#^' . $script . '#', '', $requestUri);
38 38
     } else {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
       $isSecure = true;
53 53
 
54
-    } 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')) {
54
+    } 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')) {
55 55
       $isSecure = true;
56 56
     }
57 57
 
Please login to merge, or discard this patch.
Core/System/Database.php 2 patches
Indentation   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -8,403 +8,403 @@
 block discarded – undo
8 8
 
9 9
 class Database
10 10
 {
11
-  private $app;
11
+	private $app;
12 12
 
13
-  private static $connection;
13
+	private static $connection;
14 14
 
15
-  private $table;
15
+	private $table;
16 16
 
17
-  private $rows;
17
+	private $rows;
18 18
 
19
-  private $lastId;
19
+	private $lastId;
20 20
 
21
-  private $data = [];
21
+	private $data = [];
22 22
 
23
-  private $bindings = [];
23
+	private $bindings = [];
24 24
 
25
-  private $selects = [];
25
+	private $selects = [];
26 26
 
27
-  private $joins = [];
27
+	private $joins = [];
28 28
 
29
-  private $wheres = [];
29
+	private $wheres = [];
30 30
 
31
-  private $havings = [];
31
+	private $havings = [];
32 32
 
33
-  private $orderBy = [];
33
+	private $orderBy = [];
34 34
 
35
-  private $limit;
35
+	private $limit;
36 36
 
37
-  private $offset;
37
+	private $offset;
38 38
 
39
-  private $groupBy = [];
39
+	private $groupBy = [];
40 40
 
41
-  public function __construct(Application $app)
42
-  {
43
-    $this->app = $app;
41
+	public function __construct(Application $app)
42
+	{
43
+		$this->app = $app;
44 44
 
45
-    if (! $this->isConnected()) {
46
-      $this->connect();
47
-    }
48
-  }
45
+		if (! $this->isConnected()) {
46
+			$this->connect();
47
+		}
48
+	}
49 49
 
50
-  private function isConnected()
51
-  {
52
-    return self::$connection instanceof PDO;
53
-  }
50
+	private function isConnected()
51
+	{
52
+		return self::$connection instanceof PDO;
53
+	}
54 54
 
55
-  private function connect()
56
-  {
57
-    $data = $this->app->config['db'];
55
+	private function connect()
56
+	{
57
+		$data = $this->app->config['db'];
58 58
 
59
-    extract($data);
59
+		extract($data);
60 60
 
61
-    try {
62
-      self::$connection  = new PDO('mysql:host=' . $server . ';dbname=' . $dbname, $dbuser, $dbpass);
61
+		try {
62
+			self::$connection  = new PDO('mysql:host=' . $server . ';dbname=' . $dbname, $dbuser, $dbpass);
63 63
 
64
-      self::$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
64
+			self::$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
65 65
 
66
-      self::$connection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
66
+			self::$connection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
67 67
 
68
-      self::$connection->exec('SET NAMES utf8');
68
+			self::$connection->exec('SET NAMES utf8');
69 69
 
70
-    } catch (PDOException $e) {
70
+		} catch (PDOException $e) {
71 71
 
72
-      throw new Exception($e->getMessage());
73
-    }
74
-  }
72
+			throw new Exception($e->getMessage());
73
+		}
74
+	}
75 75
 
76
-  public function connection()
77
-  {
78
-    return self::$connection;
79
-  }
76
+	public function connection()
77
+	{
78
+		return self::$connection;
79
+	}
80 80
 
81
-  public function table($table)
82
-  {
83
-    $this->table = $table;
81
+	public function table($table)
82
+	{
83
+		$this->table = $table;
84 84
 
85
-    return $this;
86
-  }
85
+		return $this;
86
+	}
87 87
 
88
-  public function select(...$select)
89
-  {
90
-    $this->selects = array_merge($this->selects, $select);
88
+	public function select(...$select)
89
+	{
90
+		$this->selects = array_merge($this->selects, $select);
91 91
 
92
-    return $this;
93
-  }
92
+		return $this;
93
+	}
94 94
 
95
-  public function join($join, $localId = null, $forginId = null)
96
-  {
97
-    if (! $localId) {
95
+	public function join($join, $localId = null, $forginId = null)
96
+	{
97
+		if (! $localId) {
98 98
 
99
-      $localId =  trim($join, 's' ). '_id';
100
-    }
99
+			$localId =  trim($join, 's' ). '_id';
100
+		}
101 101
 
102
-    if (! $forginId) {
102
+		if (! $forginId) {
103 103
 
104
-      $forginId =  'id';
105
-    }
104
+			$forginId =  'id';
105
+		}
106 106
 
107
-    $sql = $join . ' ON ' . $this->table . '.' . $localId . ' = ' . $join . '.' . $forginId;
107
+		$sql = $join . ' ON ' . $this->table . '.' . $localId . ' = ' . $join . '.' . $forginId;
108 108
 
109
-    $this->joins[] = $sql;
109
+		$this->joins[] = $sql;
110 110
 
111
-    return $this;
112
-  }
111
+		return $this;
112
+	}
113 113
 
114
-  public function where(...$bindings)
115
-  {
116
-    $sql = array_shift($bindings);
114
+	public function where(...$bindings)
115
+	{
116
+		$sql = array_shift($bindings);
117 117
 
118
-    if (is_array($bindings[0])) {
118
+		if (is_array($bindings[0])) {
119 119
 
120
-      $bindings = $bindings[0];
121
-    }
120
+			$bindings = $bindings[0];
121
+		}
122 122
 
123
-    $this->addToBindings($bindings);
123
+		$this->addToBindings($bindings);
124 124
 
125
-    $this->wheres[] = $sql;
125
+		$this->wheres[] = $sql;
126 126
 
127
-    return $this;
128
-  }
127
+		return $this;
128
+	}
129 129
 
130
-  public function having()
131
-  {
132
-    $bindings = func_get_args();
130
+	public function having()
131
+	{
132
+		$bindings = func_get_args();
133 133
 
134
-    $sql = array_shift($bindings);
134
+		$sql = array_shift($bindings);
135 135
 
136
-    $this->addToBindings($bindings);
136
+		$this->addToBindings($bindings);
137 137
 
138
-    $this->havings[] = $sql;
138
+		$this->havings[] = $sql;
139 139
 
140
-    return $this;
141
-  }
140
+		return $this;
141
+	}
142 142
 
143
-  public function groupBy(...$arguments)
144
-  {
145
-    $this->groupBy = $arguments;
143
+	public function groupBy(...$arguments)
144
+	{
145
+		$this->groupBy = $arguments;
146 146
 
147
-    return $this;
148
-  }
147
+		return $this;
148
+	}
149 149
 
150
-  public function limit($limit, $offset = 0)
151
-  {
152
-    $this->limit = $limit;
150
+	public function limit($limit, $offset = 0)
151
+	{
152
+		$this->limit = $limit;
153 153
 
154
-    $this->offset = $offset;
154
+		$this->offset = $offset;
155 155
 
156
-    return $this;
157
-  }
156
+		return $this;
157
+	}
158 158
 
159
-  public function rows()
160
-  {
161
-    return $this->rows;
162
-  }
159
+	public function rows()
160
+	{
161
+		return $this->rows;
162
+	}
163 163
 
164
-  public function orderBy($orderBy, $sort = 'ASC')
165
-  {
166
-    $this->orderBy = [$orderBy, $sort];
164
+	public function orderBy($orderBy, $sort = 'ASC')
165
+	{
166
+		$this->orderBy = [$orderBy, $sort];
167 167
 
168
-    return $this;
169
-  }
168
+		return $this;
169
+	}
170 170
 
171
-  public function fetch($table = null)
172
-  {
173
-    if ($table) {
174
-      $this->table($table);
175
-    }
171
+	public function fetch($table = null)
172
+	{
173
+		if ($table) {
174
+			$this->table($table);
175
+		}
176 176
 
177
-    $sql = $this->fetchStatment();
177
+		$sql = $this->fetchStatment();
178 178
 
179
-    $query = $this->query($sql, $this->bindings);
179
+		$query = $this->query($sql, $this->bindings);
180 180
 
181
-    $result = $query->fetch();
181
+		$result = $query->fetch();
182 182
 
183
-    $this->rows = $query->rowCount();
183
+		$this->rows = $query->rowCount();
184 184
 
185
-    return $result;
186
-  }
185
+		return $result;
186
+	}
187 187
 
188
-  public function fetchAll($table = null)
189
-  {
190
-    if ($table) {
191
-      $this->table($table);
192
-    }
188
+	public function fetchAll($table = null)
189
+	{
190
+		if ($table) {
191
+			$this->table($table);
192
+		}
193 193
 
194
-    $sql = $this->fetchStatment();
194
+		$sql = $this->fetchStatment();
195 195
 
196
-    $query = $this->query($sql, $this->bindings);
196
+		$query = $this->query($sql, $this->bindings);
197 197
 
198
-    $results = $query->fetchall();
198
+		$results = $query->fetchall();
199 199
 
200
-    $this->rows = $query->rowCount();
200
+		$this->rows = $query->rowCount();
201 201
 
202
-    return $results;
203
-  }
202
+		return $results;
203
+	}
204 204
 
205
-  private function fetchStatment()
206
-  {
207
-    $sql = 'SELECT ';
205
+	private function fetchStatment()
206
+	{
207
+		$sql = 'SELECT ';
208 208
 
209
-    $sql .= $this->selects ? implode(', ', $this->selects) : '*';
209
+		$sql .= $this->selects ? implode(', ', $this->selects) : '*';
210 210
 
211
-    $sql .= ' FROM ' . $this->table . ' ';
211
+		$sql .= ' FROM ' . $this->table . ' ';
212 212
 
213
-    if (!empty($this->joins)) {
213
+		if (!empty($this->joins)) {
214 214
 
215
-      $sql .= 'LEFT JOIN ' . implode(' ', $this->joins);
216
-    }
215
+			$sql .= 'LEFT JOIN ' . implode(' ', $this->joins);
216
+		}
217 217
 
218
-    if (!empty($this->wheres)) {
218
+		if (!empty($this->wheres)) {
219 219
 
220
-      $sql .= ' WHERE ' . implode(' ', $this->wheres);
221
-    }
220
+			$sql .= ' WHERE ' . implode(' ', $this->wheres);
221
+		}
222 222
 
223
-    if (!empty($this->havings)) {
223
+		if (!empty($this->havings)) {
224 224
 
225
-      $sql .= ' HAVING ' . implode(' ', $this->havings) . ' ';
226
-    }
225
+			$sql .= ' HAVING ' . implode(' ', $this->havings) . ' ';
226
+		}
227 227
 
228
-    if (!empty($this->orderBy)) {
228
+		if (!empty($this->orderBy)) {
229 229
 
230
-      $sql .= ' ORDER BY ' . implode (' ', $this->orderBy);
231
-    }
230
+			$sql .= ' ORDER BY ' . implode (' ', $this->orderBy);
231
+		}
232 232
 
233
-    if ($this->limit) {
233
+		if ($this->limit) {
234 234
 
235
-      $sql .= ' LIMIT ' . $this->limit;
236
-    }
235
+			$sql .= ' LIMIT ' . $this->limit;
236
+		}
237 237
 
238
-    if ($this->offset) {
238
+		if ($this->offset) {
239 239
 
240
-      $sql .= ' OFFSET ' . $this->offset;
241
-    }
240
+			$sql .= ' OFFSET ' . $this->offset;
241
+		}
242 242
 
243
-    if (!empty($this->groupBy)) {
244
-      $sql .= ' GROUP BY ' . implode(' ' , $this->groupBy);
245
-    }
243
+		if (!empty($this->groupBy)) {
244
+			$sql .= ' GROUP BY ' . implode(' ' , $this->groupBy);
245
+		}
246 246
 
247
-    return $sql;
248
-  }
247
+		return $sql;
248
+	}
249 249
 
250
-  public function lastId()
251
-  {
252
-    return $this->lastId;
253
-  }
250
+	public function lastId()
251
+	{
252
+		return $this->lastId;
253
+	}
254 254
 
255
-  public function from($table)
256
-  {
257
-    return $this->table($table);
258
-  }
255
+	public function from($table)
256
+	{
257
+		return $this->table($table);
258
+	}
259 259
 
260
-  public function data($key, $value = null)
261
-  {
262
-    if (is_array($key)) {
260
+	public function data($key, $value = null)
261
+	{
262
+		if (is_array($key)) {
263 263
 
264
-      $this->data = array_merge($this->data, $key);
264
+			$this->data = array_merge($this->data, $key);
265 265
 
266
-      $this->addToBindings($key);
266
+			$this->addToBindings($key);
267 267
 
268
-    } else {
268
+		} else {
269 269
 
270
-      $this->data[$key] = $value;
270
+			$this->data[$key] = $value;
271 271
 
272
-      $this->addToBindings($value);
272
+			$this->addToBindings($value);
273 273
 
274
-    }
274
+		}
275 275
 
276
-    return $this;
277
-  }
276
+		return $this;
277
+	}
278 278
 
279
-  public function insert($table = null)
280
-  {
281
-    if ($table) {
282
-      $this->table($table);
283
-    }
279
+	public function insert($table = null)
280
+	{
281
+		if ($table) {
282
+			$this->table($table);
283
+		}
284 284
 
285
-    $sql = 'INSERT INTO ' . $this->table . ' SET ';
285
+		$sql = 'INSERT INTO ' . $this->table . ' SET ';
286 286
 
287
-    $sql .= $this->setField();
287
+		$sql .= $this->setField();
288 288
 
289
-    $this->query($sql, $this->bindings);
289
+		$this->query($sql, $this->bindings);
290 290
 
291
-    $this->lastId = $this->connection()->lastInsertId();
291
+		$this->lastId = $this->connection()->lastInsertId();
292 292
 
293
-    return $this;
294
-  }
293
+		return $this;
294
+	}
295 295
 
296
-  public function update($table = null)
297
-  {
298
-    if ($table) {
299
-      $this->table($table);
300
-    }
296
+	public function update($table = null)
297
+	{
298
+		if ($table) {
299
+			$this->table($table);
300
+		}
301 301
 
302
-    $sql = 'UPDATE ' . $this->table . ' SET ';
302
+		$sql = 'UPDATE ' . $this->table . ' SET ';
303 303
 
304
-    $sql .= $this->setField();
304
+		$sql .= $this->setField();
305 305
 
306
-    if (!empty($this->wheres)) {
307
-      $sql .= ' WHERE ' . implode('', $this->wheres);
308
-    }
306
+		if (!empty($this->wheres)) {
307
+			$sql .= ' WHERE ' . implode('', $this->wheres);
308
+		}
309 309
 
310
-    $this->query($sql, $this->bindings);
310
+		$this->query($sql, $this->bindings);
311 311
 
312
-    return $this;
313
-  }
312
+		return $this;
313
+	}
314 314
 
315
-  public function delete($table = null)
316
-  {
317
-    if ($table) {
318
-      $this->table($table);
319
-    }
315
+	public function delete($table = null)
316
+	{
317
+		if ($table) {
318
+			$this->table($table);
319
+		}
320 320
 
321
-    $sql = 'DELETE FROM ' . $this->table . ' ';
321
+		$sql = 'DELETE FROM ' . $this->table . ' ';
322 322
 
323
-    if (!empty($this->wheres)) {
324
-      $sql .= ' WHERE ' . implode('', $this->wheres);
325
-    }
323
+		if (!empty($this->wheres)) {
324
+			$sql .= ' WHERE ' . implode('', $this->wheres);
325
+		}
326 326
 
327
-    $this->query($sql, $this->bindings);
327
+		$this->query($sql, $this->bindings);
328 328
 
329
-    return $this;
330
-  }
329
+		return $this;
330
+	}
331 331
 
332
-  private function setField()
333
-  {
334
-    $sql = '';
332
+	private function setField()
333
+	{
334
+		$sql = '';
335 335
 
336
-    foreach($this->data as $key => $value) {
336
+		foreach($this->data as $key => $value) {
337 337
 
338
-      $sql .= '`' . $key . '` = ? ,';
339
-    }
338
+			$sql .= '`' . $key . '` = ? ,';
339
+		}
340 340
 
341
-    $sql = rtrim($sql, ' ,');
341
+		$sql = rtrim($sql, ' ,');
342 342
 
343
-    return $sql;
344
-  }
343
+		return $sql;
344
+	}
345 345
 
346
-  private function addToBindings($value)
347
-  {
348
-    if (is_array($value)) {
346
+	private function addToBindings($value)
347
+	{
348
+		if (is_array($value)) {
349 349
 
350
-      $this->bindings = array_merge($this->bindings, array_values($value));
351
-    } else {
350
+			$this->bindings = array_merge($this->bindings, array_values($value));
351
+		} else {
352 352
 
353
-      $this->bindings[] = $value;
354
-    }
355
-  }
353
+			$this->bindings[] = $value;
354
+		}
355
+	}
356 356
 
357
-  public function query(...$bindings)
358
-  {
359
-    $sql = array_shift($bindings);
357
+	public function query(...$bindings)
358
+	{
359
+		$sql = array_shift($bindings);
360 360
 
361
-    if (count($bindings) == 1 AND is_array($bindings[0])) {
362
-      $bindings = $bindings[0];
363
-    }
361
+		if (count($bindings) == 1 AND is_array($bindings[0])) {
362
+			$bindings = $bindings[0];
363
+		}
364 364
 
365
-    try {
366
-        $query = $this->connection()->prepare($sql);
365
+		try {
366
+				$query = $this->connection()->prepare($sql);
367 367
 
368
-        foreach ($bindings as $key => $value) {
369
-          $query->bindValue($key + 1, _e($value));
370
-        }
368
+				foreach ($bindings as $key => $value) {
369
+					$query->bindValue($key + 1, _e($value));
370
+				}
371 371
 
372
-        $query->execute();
372
+				$query->execute();
373 373
 
374
-        $this->reset();
374
+				$this->reset();
375 375
 
376
-        return $query;
376
+				return $query;
377 377
 
378
-    } catch (PDOException $e) {
378
+		} catch (PDOException $e) {
379 379
 
380
-      throw new Exception($e->getMessage());
381
-    }
382
-  }
380
+			throw new Exception($e->getMessage());
381
+		}
382
+	}
383 383
 
384
-  private function reset()
385
-  {
386
-    $this->table = null;
384
+	private function reset()
385
+	{
386
+		$this->table = null;
387 387
 
388
-    $this->rows = 0;
388
+		$this->rows = 0;
389 389
 
390
-    $this->data = [];
390
+		$this->data = [];
391 391
 
392
-    $this->bindings = [];
392
+		$this->bindings = [];
393 393
 
394
-    $this->selects = [];
394
+		$this->selects = [];
395 395
 
396
-    $this->joins = [];
396
+		$this->joins = [];
397 397
 
398
-    $this->wheres = [];
398
+		$this->wheres = [];
399 399
 
400
-    $this->havings = [];
400
+		$this->havings = [];
401 401
 
402
-    $this->orderBy = [];
402
+		$this->orderBy = [];
403 403
 
404
-    $this->limit = null;
404
+		$this->limit = null;
405 405
 
406
-    $this->offset = 0;
406
+		$this->offset = 0;
407 407
 
408
-    $this->groupBy = [];
409
-  }
408
+		$this->groupBy = [];
409
+	}
410 410
 }
411 411
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
59 59
     extract($data);
60 60
 
61 61
     try {
62
-      self::$connection  = new PDO('mysql:host=' . $server . ';dbname=' . $dbname, $dbuser, $dbpass);
62
+      self::$connection = new PDO('mysql:host=' . $server . ';dbname=' . $dbname, $dbuser, $dbpass);
63 63
 
64 64
       self::$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
65 65
 
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 
95 95
   public function join($join, $localId = null, $forginId = null)
96 96
   {
97
-    if (! $localId) {
97
+    if (!$localId) {
98 98
 
99
-      $localId =  trim($join, 's' ). '_id';
99
+      $localId = trim($join, 's') . '_id';
100 100
     }
101 101
 
102
-    if (! $forginId) {
102
+    if (!$forginId) {
103 103
 
104
-      $forginId =  'id';
104
+      $forginId = 'id';
105 105
     }
106 106
 
107 107
     $sql = $join . ' ON ' . $this->table . '.' . $localId . ' = ' . $join . '.' . $forginId;
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
     if (!empty($this->orderBy)) {
229 229
 
230
-      $sql .= ' ORDER BY ' . implode (' ', $this->orderBy);
230
+      $sql .= ' ORDER BY ' . implode(' ', $this->orderBy);
231 231
     }
232 232
 
233 233
     if ($this->limit) {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     }
242 242
 
243 243
     if (!empty($this->groupBy)) {
244
-      $sql .= ' GROUP BY ' . implode(' ' , $this->groupBy);
244
+      $sql .= ' GROUP BY ' . implode(' ', $this->groupBy);
245 245
     }
246 246
 
247 247
     return $sql;
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
   {
334 334
     $sql = '';
335 335
 
336
-    foreach($this->data as $key => $value) {
336
+    foreach ($this->data as $key => $value) {
337 337
 
338 338
       $sql .= '`' . $key . '` = ? ,';
339 339
     }
Please login to merge, or discard this patch.
App/Models/LoginModel.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -6,52 +6,52 @@
 block discarded – undo
6 6
 
7 7
 class LoginModel extends Model
8 8
 {
9
-  protected $table = 'users';
9
+	protected $table = 'users';
10 10
 
11
-  private $user;
11
+	private $user;
12 12
 
13
-  public function isValidLogin($email, $password)
14
-  {
15
-    $user = $this->where('email=?' , $email)->fetch($this->table);
13
+	public function isValidLogin($email, $password)
14
+	{
15
+		$user = $this->where('email=?' , $email)->fetch($this->table);
16 16
 
17
-    if (! $user) {
17
+		if (! $user) {
18 18
 
19
-      return false;
20
-    }
19
+			return false;
20
+		}
21 21
 
22
-    $this->user = $user;
22
+		$this->user = $user;
23 23
 
24
-    return password_verify($password, $user->password);
25
-  }
24
+		return password_verify($password, $user->password);
25
+	}
26 26
 
27
-  public function user()
28
-  {
29
-    return $this->user;
30
-  }
27
+	public function user()
28
+	{
29
+		return $this->user;
30
+	}
31 31
 
32
-  public function isLogged()
33
-  {
34
-    if ($this->cookie->has('login')) {
32
+	public function isLogged()
33
+	{
34
+		if ($this->cookie->has('login')) {
35 35
 
36
-      $code = $this->cookie->get('login');
36
+			$code = $this->cookie->get('login');
37 37
 
38
-    } elseif ($this->session->has('login')) {
38
+		} elseif ($this->session->has('login')) {
39 39
 
40
-      $code = $this->session->get('login');
40
+			$code = $this->session->get('login');
41 41
 
42
-    } else {
42
+		} else {
43 43
 
44
-      return false;
45
-    }
44
+			return false;
45
+		}
46 46
 
47
-    $user = $this->where('code=?' , $code)->fetch($this->table);
47
+		$user = $this->where('code=?' , $code)->fetch($this->table);
48 48
 
49
-    if (! $user) {
50
-      return false;
51
-    }
49
+		if (! $user) {
50
+			return false;
51
+		}
52 52
 
53
-    $this->user = $user;
53
+		$this->user = $user;
54 54
 
55
-    return true;
56
-  }
55
+		return true;
56
+	}
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 
13 13
   public function isValidLogin($email, $password)
14 14
   {
15
-    $user = $this->where('email=?' , $email)->fetch($this->table);
15
+    $user = $this->where('email=?', $email)->fetch($this->table);
16 16
 
17
-    if (! $user) {
17
+    if (!$user) {
18 18
 
19 19
       return false;
20 20
     }
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
       return false;
45 45
     }
46 46
 
47
-    $user = $this->where('code=?' , $code)->fetch($this->table);
47
+    $user = $this->where('code=?', $code)->fetch($this->table);
48 48
 
49
-    if (! $user) {
49
+    if (!$user) {
50 50
       return false;
51 51
     }
52 52
 
Please login to merge, or discard this patch.
App/Middleware/Admin/AuthenticateMiddleware.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -7,32 +7,32 @@
 block discarded – undo
7 7
 
8 8
 class AuthenticateMiddleware implements Middleware
9 9
 {
10
-  public function handle(Application $app, $next)
11
-  {
12
-    $request = $app->request->url();
10
+	public function handle(Application $app, $next)
11
+	{
12
+		$request = $app->request->url();
13 13
 
14
-    $login = $app->load->model('Login');
14
+		$login = $app->load->model('Login');
15 15
 
16
-    $pagesWhenLogout = [
17
-      '/login',
18
-      '/login/submit',
19
-      '/registration',
20
-      '/registration/submit'
21
-    ];
16
+		$pagesWhenLogout = [
17
+			'/login',
18
+			'/login/submit',
19
+			'/registration',
20
+			'/registration/submit'
21
+		];
22 22
 
23
-    if ($login->isLogged()) {
23
+		if ($login->isLogged()) {
24 24
 
25
-      if (in_array($request, $pagesWhenLogout)) {
26
-        $app->url->redirectTo('/');
27
-      }
25
+			if (in_array($request, $pagesWhenLogout)) {
26
+				$app->url->redirectTo('/');
27
+			}
28 28
 
29
-    } else {
29
+		} else {
30 30
 
31
-      if (!in_array($request, $pagesWhenLogout)) {
32
-        $app->url->redirectTo('/');
33
-      }
34
-    }
31
+			if (!in_array($request, $pagesWhenLogout)) {
32
+				$app->url->redirectTo('/');
33
+			}
34
+		}
35 35
 
36
-    return $next;
37
-  }
36
+		return $next;
37
+	}
38 38
 }
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
Core/System/Session.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -4,60 +4,60 @@
 block discarded – undo
4 4
 
5 5
 class Session
6 6
 {
7
-  private $app;
8
-
9
-  public function __construct(Application $app)
10
-  {
11
-    $this->app = $app;
12
-  }
13
-
14
-  public function start()
15
-  {
16
-    ini_set('session.use_only_cookies', 1);
17
-
18
-    if (!session_id()) {
19
-      session_start();
20
-    }
21
-  }
22
-
23
-  public function set($key, $value)
24
-  {
25
-    $_SESSION[$key] = $value;
26
-  }
27
-
28
-  public function get($key, $default = null)
29
-  {
30
-    return array_get($_SESSION, $key, $default);
31
-  }
32
-
33
-  public function pull($key)
34
-  {
35
-    $value = $this->get($key);
36
-
37
-    $this->remove($key);
38
-
39
-    return $value;
40
-  }
41
-
42
-  public function has($key)
43
-  {
44
-    return isset($_SESSION[$key]);
45
-  }
46
-
47
-  public function all()
48
-  {
49
-    return $_SESSION;
50
-  }
51
-
52
-  public function remove($key)
53
-  {
54
-    unset($_SESSION[$key]);
55
-  }
56
-
57
-  public function destroy()
58
-  {
59
-    session_destroy();
60
-
61
-    unset($_SESSION);
62
-  }
7
+	private $app;
8
+
9
+	public function __construct(Application $app)
10
+	{
11
+		$this->app = $app;
12
+	}
13
+
14
+	public function start()
15
+	{
16
+		ini_set('session.use_only_cookies', 1);
17
+
18
+		if (!session_id()) {
19
+			session_start();
20
+		}
21
+	}
22
+
23
+	public function set($key, $value)
24
+	{
25
+		$_SESSION[$key] = $value;
26
+	}
27
+
28
+	public function get($key, $default = null)
29
+	{
30
+		return array_get($_SESSION, $key, $default);
31
+	}
32
+
33
+	public function pull($key)
34
+	{
35
+		$value = $this->get($key);
36
+
37
+		$this->remove($key);
38
+
39
+		return $value;
40
+	}
41
+
42
+	public function has($key)
43
+	{
44
+		return isset($_SESSION[$key]);
45
+	}
46
+
47
+	public function all()
48
+	{
49
+		return $_SESSION;
50
+	}
51
+
52
+	public function remove($key)
53
+	{
54
+		unset($_SESSION[$key]);
55
+	}
56
+
57
+	public function destroy()
58
+	{
59
+		session_destroy();
60
+
61
+		unset($_SESSION);
62
+	}
63 63
 }
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
Core/System/Cookie.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -4,53 +4,53 @@
 block discarded – undo
4 4
 
5 5
 class Cookie
6 6
 {
7
-  private $app;
7
+	private $app;
8 8
 
9
-  private $path;
9
+	private $path;
10 10
 
11
-  public function __construct(Application $app)
12
-  {
13
-    $this->app = $app;
11
+	public function __construct(Application $app)
12
+	{
13
+		$this->app = $app;
14 14
 
15
-    $this->path = dirname($this->app->request->server('SCRIPT_NAME')) ?: '/';
16
-  }
15
+		$this->path = dirname($this->app->request->server('SCRIPT_NAME')) ?: '/';
16
+	}
17 17
 
18
-  public function set($key, $value, $hours = 1800)
19
-  {
20
-    $expireTime = $hours == -1 ? -1 : time() + $hours * 3600;
18
+	public function set($key, $value, $hours = 1800)
19
+	{
20
+		$expireTime = $hours == -1 ? -1 : time() + $hours * 3600;
21 21
 
22
-    setcookie($key, $value, $expireTime, $this->path, '', false, true);
23
-  }
22
+		setcookie($key, $value, $expireTime, $this->path, '', false, true);
23
+	}
24 24
 
25
-  public function get($key, $default = null)
26
-  {
27
-    return array_get($_COOKIE, $key, $default);
28
-  }
25
+	public function get($key, $default = null)
26
+	{
27
+		return array_get($_COOKIE, $key, $default);
28
+	}
29 29
 
30
-  public function has($key)
31
-  {
32
-    return array_key_exists($key, $_COOKIE);
33
-  }
30
+	public function has($key)
31
+	{
32
+		return array_key_exists($key, $_COOKIE);
33
+	}
34 34
 
35
-  public function remove($key)
36
-  {
37
-    $this->set($key, null, -1);
35
+	public function remove($key)
36
+	{
37
+		$this->set($key, null, -1);
38 38
 
39
-    unset($_COOKIE[$key]);
40
-  }
39
+		unset($_COOKIE[$key]);
40
+	}
41 41
 
42
-  public function all()
43
-  {
44
-    return $_COOKIE;
45
-  }
42
+	public function all()
43
+	{
44
+		return $_COOKIE;
45
+	}
46 46
 
47
-  public function destroy()
48
-  {
49
-    foreach (array_keys($this->all()) as $key) {
47
+	public function destroy()
48
+	{
49
+		foreach (array_keys($this->all()) as $key) {
50 50
 
51
-      $this->remove($key);
52
-    }
51
+			$this->remove($key);
52
+		}
53 53
 
54
-    unset($_COOKIE);
55
-  }
54
+		unset($_COOKIE);
55
+	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
Core/System/Model.php 2 patches
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -4,125 +4,125 @@
 block discarded – undo
4 4
 
5 5
 abstract class Model
6 6
 {
7
-  protected $app;
7
+	protected $app;
8 8
 
9
-  protected $table;
9
+	protected $table;
10 10
 
11
-  public function __construct(Application $app)
12
-  {
13
-    $this->app = $app;
14
-  }
11
+	public function __construct(Application $app)
12
+	{
13
+		$this->app = $app;
14
+	}
15 15
 
16
-  public function __get($key)
17
-  {
18
-    return $this->app->get($key);
19
-  }
16
+	public function __get($key)
17
+	{
18
+		return $this->app->get($key);
19
+	}
20 20
 
21
-  public function __call($method, $args)
22
-  {
23
-    return call_user_func_array([$this->app->db, $method], $args);
24
-  }
21
+	public function __call($method, $args)
22
+	{
23
+		return call_user_func_array([$this->app->db, $method], $args);
24
+	}
25 25
 
26
-  public function all($limit = null)
27
-  {
28
-    return $this->orderBy('id', 'DESC')->limit($limit)->fetchAll($this->table);
29
-  }
26
+	public function all($limit = null)
27
+	{
28
+		return $this->orderBy('id', 'DESC')->limit($limit)->fetchAll($this->table);
29
+	}
30 30
 
31
-  public function allEnable($limit = null)
32
-  {
33
-    return $this->orderBy('id', 'DESC')->where('enable = ?', 1)->limit($limit)->fetchAll($this->table);
34
-  }
31
+	public function allEnable($limit = null)
32
+	{
33
+		return $this->orderBy('id', 'DESC')->where('enable = ?', 1)->limit($limit)->fetchAll($this->table);
34
+	}
35 35
 
36
-  public function get($value, $coulmn = 'id')
37
-  {
38
-    return $this->where($coulmn . ' = ?', $value)->fetch($this->table);
39
-  }
36
+	public function get($value, $coulmn = 'id')
37
+	{
38
+		return $this->where($coulmn . ' = ?', $value)->fetch($this->table);
39
+	}
40 40
 
41
-  public function getEnable($value, $coulmn = 'id')
42
-  {
43
-    return $this->where($coulmn . ' = ? AND enable = ?' , [$value, 1])->fetch($this->table);
44
-  }
41
+	public function getEnable($value, $coulmn = 'id')
42
+	{
43
+		return $this->where($coulmn . ' = ? AND enable = ?' , [$value, 1])->fetch($this->table);
44
+	}
45 45
 
46
-  public function selectTable($coulmn)
47
-  {
48
-    return $this->select($coulmn)->fetchAll($this->table);
49
-  }
46
+	public function selectTable($coulmn)
47
+	{
48
+		return $this->select($coulmn)->fetchAll($this->table);
49
+	}
50 50
 
51
-  public function exists($value, $key = 'id')
52
-  {
53
-    return (bool) $this->select($key)->where($key .'=?', $value)->fetch($this->table);
54
-  }
51
+	public function exists($value, $key = 'id')
52
+	{
53
+		return (bool) $this->select($key)->where($key .'=?', $value)->fetch($this->table);
54
+	}
55 55
 
56
-  public function delete($id)
57
-  {
58
-    return $this->where('id = ?', $id)->delete($this->table);
59
-  }
56
+	public function delete($id)
57
+	{
58
+		return $this->where('id = ?', $id)->delete($this->table);
59
+	}
60 60
 
61
-  public function hasOne($join, $id = null, $select = '*', $limit = null, $localId = null, $forginId = null)
62
-  {
63
-    $join = rtrim($join, 'Model');
61
+	public function hasOne($join, $id = null, $select = '*', $limit = null, $localId = null, $forginId = null)
62
+	{
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
-    $exists = $this->app->file->exists($file);
67
+		$exists = $this->app->file->exists($file);
68 68
 
69
-    if (!$exists) {
70
-      return $join . ' Not Found';
71
-    }
69
+		if (!$exists) {
70
+			return $join . ' Not Found';
71
+		}
72 72
 
73
-    $trace = debug_backtrace();
73
+		$trace = debug_backtrace();
74 74
 
75
-    $table = $trace[1]['object']->table;
75
+		$table = $trace[1]['object']->table;
76 76
 
77
-    $join = $this->load->model($join)->table;
77
+		$join = $this->load->model($join)->table;
78 78
 
79
-    return $this->db->select($select)->from($table)->join($join, $localId, $forginId)->where($table . '.id = ?', $id)->limit($limit)->fetch();
80
-  }
79
+		return $this->db->select($select)->from($table)->join($join, $localId, $forginId)->where($table . '.id = ?', $id)->limit($limit)->fetch();
80
+	}
81 81
 
82
-  public function hasMany($join, $id = null, $select = '*', $limit = null, $localId = null, $forginId = null)
83
-  {
84
-    $join = rtrim($join, 'Model');
82
+	public function hasMany($join, $id = null, $select = '*', $limit = null, $localId = null, $forginId = null)
83
+	{
84
+		$join = rtrim($join, 'Model');
85 85
 
86
-    $file = $this->app->file->to('App/Models/' . $join . 'Model', '.php');
86
+		$file = $this->app->file->to('App/Models/' . $join . 'Model', '.php');
87 87
 
88
-    $exists = $this->app->file->exists($file);
88
+		$exists = $this->app->file->exists($file);
89 89
 
90
-    if (!$exists) {
91
-      return $join . ' Not Found';
92
-    }
90
+		if (!$exists) {
91
+			return $join . ' Not Found';
92
+		}
93 93
 
94
-    $trace = debug_backtrace();
94
+		$trace = debug_backtrace();
95 95
 
96
-    $table = $trace[1]['object']->table;
96
+		$table = $trace[1]['object']->table;
97 97
 
98
-    $join = $this->load->model($join)->table;
98
+		$join = $this->load->model($join)->table;
99 99
 
100
-    return $this->db->select($select)->from($table)->join($join, $localId, $forginId)->where($table . '.id = ?', $id)->limit($limit)->fetchAll();
101
-  }
100
+		return $this->db->select($select)->from($table)->join($join, $localId, $forginId)->where($table . '.id = ?', $id)->limit($limit)->fetchAll();
101
+	}
102 102
 
103
-  public function join($join, $limit = null, $enable = null, $localId = null, $forginId = null)
104
-  {
105
-    $join = rtrim($join, 'Model');
103
+	public function join($join, $limit = null, $enable = null, $localId = null, $forginId = null)
104
+	{
105
+		$join = rtrim($join, 'Model');
106 106
 
107
-    $file = $this->app->file->to('App/Models/' . $join . 'Model', '.php');
107
+		$file = $this->app->file->to('App/Models/' . $join . 'Model', '.php');
108 108
 
109
-    $exists = $this->app->file->exists($file);
109
+		$exists = $this->app->file->exists($file);
110 110
 
111
-    if (!$exists) {
112
-      return $join . ' Not Found';
113
-    }
111
+		if (!$exists) {
112
+			return $join . ' Not Found';
113
+		}
114 114
 
115
-    $trace = debug_backtrace();
115
+		$trace = debug_backtrace();
116 116
 
117
-    $table = $trace[1]['object']->table;
117
+		$table = $trace[1]['object']->table;
118 118
 
119
-    $join = $this->load->model($join)->table;
119
+		$join = $this->load->model($join)->table;
120 120
 
121
-    if ($enable) {
121
+		if ($enable) {
122 122
 
123
-      return $this->db->select()->from($table)->join($join, $localId, $forginId)->where('enable = ?', 1)->limit($limit)->fetchAll();
124
-    }
123
+			return $this->db->select()->from($table)->join($join, $localId, $forginId)->where('enable = ?', 1)->limit($limit)->fetchAll();
124
+		}
125 125
 
126
-    return $this->db->select()->from($table)->join($join, $localId, $forginId)->limit($limit)->fetchAll();
127
-  }
126
+		return $this->db->select()->from($table)->join($join, $localId, $forginId)->limit($limit)->fetchAll();
127
+	}
128 128
 }
129 129
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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,7 +50,7 @@  discard block
 block discarded – undo
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)
Please login to merge, or discard this patch.
Core/System/Loader.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -6,99 +6,99 @@
 block discarded – undo
6 6
 
7 7
 class Loader
8 8
 {
9
-  private $app;
9
+	private $app;
10 10
 
11
-  private $controllers = [];
11
+	private $controllers = [];
12 12
 
13
-  private $models = [];
13
+	private $models = [];
14 14
 
15
-  public function __construct(Application $app)
16
-  {
17
-    $this->app = $app;
18
-  }
15
+	public function __construct(Application $app)
16
+	{
17
+		$this->app = $app;
18
+	}
19 19
 
20
-  public function action($controller, $method, array $arguments)
21
-  {
22
-    $object = $this->controller($controller);
20
+	public function action($controller, $method, array $arguments)
21
+	{
22
+		$object = $this->controller($controller);
23 23
 
24
-    return call_user_func([$object, $method], $arguments);
25
-  }
24
+		return call_user_func([$object, $method], $arguments);
25
+	}
26 26
 
27
-  public function controller($controller)
28
-  {
29
-    $controller = $this->getControllerName($controller);
27
+	public function controller($controller)
28
+	{
29
+		$controller = $this->getControllerName($controller);
30 30
 
31
-    if (!$this->hasController($controller)) {
32
-      $this->addController($controller);
33
-    }
31
+		if (!$this->hasController($controller)) {
32
+			$this->addController($controller);
33
+		}
34 34
 
35
-    return $this->getController($controller);
36
-  }
35
+		return $this->getController($controller);
36
+	}
37 37
 
38
-  private function hasController($controller)
39
-  {
40
-    return array_key_exists($controller, $this->controllers);
41
-  }
38
+	private function hasController($controller)
39
+	{
40
+		return array_key_exists($controller, $this->controllers);
41
+	}
42 42
 
43
-  private function addController($controller)
44
-  {
45
-    $object = new $controller($this->app);
43
+	private function addController($controller)
44
+	{
45
+		$object = new $controller($this->app);
46 46
 
47
-    $this->controllers[$controller] = $object;
48
-  }
47
+		$this->controllers[$controller] = $object;
48
+	}
49 49
 
50
-  private function getController($controller)
51
-  {
52
-    return $this->controllers[$controller];
53
-  }
50
+	private function getController($controller)
51
+	{
52
+		return $this->controllers[$controller];
53
+	}
54 54
 
55
-  private function getControllerName($controller)
56
-  {
57
-    $controller .= strpos($controller, 'Controller') ? '' : 'Controller';
55
+	private function getControllerName($controller)
56
+	{
57
+		$controller .= strpos($controller, 'Controller') ? '' : 'Controller';
58 58
 
59
-    $controller = str_replace('/', DS, $controller);
59
+		$controller = str_replace('/', DS, $controller);
60 60
 
61
-    $controller = 'App' . DS . 'Controllers' . DS . $controller;
61
+		$controller = 'App' . DS . 'Controllers' . DS . $controller;
62 62
 
63
-    return $controller;
64
-  }
63
+		return $controller;
64
+	}
65 65
 
66
-  public function model($model)
67
-  {
68
-    $model = $this->getModelName($model);
66
+	public function model($model)
67
+	{
68
+		$model = $this->getModelName($model);
69 69
 
70
-    if (!$this->hasModel($model)) {
71
-      $this->addModel($model);
72
-    }
70
+		if (!$this->hasModel($model)) {
71
+			$this->addModel($model);
72
+		}
73 73
 
74
-    return $this->getModel($model);
75
-  }
74
+		return $this->getModel($model);
75
+	}
76 76
 
77
-  private function hasModel($model)
78
-  {
79
-    return array_key_exists($model, $this->models);
80
-  }
77
+	private function hasModel($model)
78
+	{
79
+		return array_key_exists($model, $this->models);
80
+	}
81 81
 
82
-  private function addModel($model)
83
-  {
84
-    $object = new $model($this->app);
82
+	private function addModel($model)
83
+	{
84
+		$object = new $model($this->app);
85 85
 
86
-    $this->models[$model] = $object;
87
-  }
86
+		$this->models[$model] = $object;
87
+	}
88 88
 
89
-  private function getModel($model)
90
-  {
91
-    return $this->models[$model];
92
-  }
89
+	private function getModel($model)
90
+	{
91
+		return $this->models[$model];
92
+	}
93 93
 
94
-  private function getModelName($model)
95
-  {
96
-    $model .= strpos($model, 'Model') ? '' : 'Model';
94
+	private function getModelName($model)
95
+	{
96
+		$model .= strpos($model, 'Model') ? '' : 'Model';
97 97
 
98
-    $model = str_replace('/', DS, $model);
98
+		$model = str_replace('/', DS, $model);
99 99
 
100
-    $model = 'App' . DS . 'Models' . DS . $model;
100
+		$model = 'App' . DS . 'Models' . DS . $model;
101 101
 
102
-    return $model;
103
-  }
102
+		return $model;
103
+	}
104 104
 }
105 105
\ No newline at end of file
Please login to merge, or discard this patch.