Passed
Branch master (8656ae)
by refat
03:19
created
App/Models/UsersGroupsModel.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
       $userGroup->pages = [];
20 20
 
21
-      foreach($userGroupInfos as $userGroupInfo) {
21
+      foreach ($userGroupInfos as $userGroupInfo) {
22 22
 
23 23
         $userGroup->pages[] = $userGroupInfo->page;
24 24
       }
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
 
7 7
 class UsersGroupsModel extends Model
8 8
 {
9
-  protected $table = 'users_groups';
9
+	protected $table = 'users_groups';
10 10
 
11
-  public function get($id)
12
-  {
13
-    $userGroup = parent::get($id);
11
+	public function get($id)
12
+	{
13
+		$userGroup = parent::get($id);
14 14
 
15
-    if ($userGroup) {
15
+		if ($userGroup) {
16 16
 
17
-      $userGroupInfos = $this->hasMany('UsersGroupPermissionsModel', $id);
17
+			$userGroupInfos = $this->hasMany('UsersGroupPermissionsModel', $id);
18 18
 
19
-      $userGroup->pages = [];
19
+			$userGroup->pages = [];
20 20
 
21
-      foreach($userGroupInfos as $userGroupInfo) {
21
+			foreach($userGroupInfos as $userGroupInfo) {
22 22
 
23
-        $userGroup->pages[] = $userGroupInfo->page;
24
-      }
23
+				$userGroup->pages[] = $userGroupInfo->page;
24
+			}
25 25
 
26
-      return $userGroup;
27
-    }
28
-  }
26
+			return $userGroup;
27
+		}
28
+	}
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
App/Models/SettingsModel.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
   public function loadAll()
14 14
   {
15
-    foreach($this->all() as $setting) {
15
+    foreach ($this->all() as $setting) {
16 16
 
17 17
       $this->settings[$setting->key] = $setting->value;
18 18
     }
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@
 block discarded – undo
6 6
 
7 7
 class SettingsModel extends Model
8 8
 {
9
-  protected $table = 'settings';
9
+	protected $table = 'settings';
10 10
 
11
-  private $settings;
11
+	private $settings;
12 12
 
13
-  public function loadAll()
14
-  {
15
-    foreach($this->all() as $setting) {
13
+	public function loadAll()
14
+	{
15
+		foreach($this->all() as $setting) {
16 16
 
17
-      $this->settings[$setting->key] = $setting->value;
18
-    }
19
-  }
17
+			$this->settings[$setting->key] = $setting->value;
18
+		}
19
+	}
20 20
 
21
-  public function get($key)
22
-  {
23
-    return array_get($this->settings, $key);
24
-  }
21
+	public function get($key)
22
+	{
23
+		return array_get($this->settings, $key);
24
+	}
25 25
 
26
-  public function updateSettings()
27
-  {
26
+	public function updateSettings()
27
+	{
28 28
 
29
-  }
29
+	}
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
routes/admin/index.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
   'middleware' => ['admin']
28 28
 ];
29 29
 
30
-$app->route->group($adminOptions, function ($route) {
30
+$app->route->group($adminOptions, function($route) {
31 31
 
32 32
   $route->add('/', 'Home');
33 33
 
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,23 +3,23 @@
 block discarded – undo
3 3
 $app = app();
4 4
 
5 5
 $adminOptions = [
6
-  'prefix' => '/admin',
7
-  'controller' => 'Admin',
8
-  'middleware' => ['admin']
6
+	'prefix' => '/admin',
7
+	'controller' => 'Admin',
8
+	'middleware' => ['admin']
9 9
 ];
10 10
 
11 11
 $app->route->group($adminOptions, function ($route) {
12 12
 
13
-  $route->add('/', 'Home');
13
+	$route->add('/', 'Home');
14 14
 
15
-  //Login
16
-  $route->add('/login', 'Login');
17
-  $route->add('/submit', 'Login@submit', 'POST');
18
-  $route->add('/logout', 'Logout');
15
+	//Login
16
+	$route->add('/login', 'Login');
17
+	$route->add('/submit', 'Login@submit', 'POST');
18
+	$route->add('/logout', 'Logout');
19 19
 
20
-  //Profile
21
-  $route->add('/profile', 'Profile', 'GET');
20
+	//Profile
21
+	$route->add('/profile', 'Profile', 'GET');
22 22
 
23
-  //Settings
24
-  $route->add('/settings', 'Settings');
23
+	//Settings
24
+	$route->add('/settings', 'Settings');
25 25
 });
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
Core/System/Application.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 
90 90
   public function get($key)
91 91
   {
92
-    if (! $this->isSharing($key)) {
92
+    if (!$this->isSharing($key)) {
93 93
 
94 94
       if ($this->isCoreAlias($key)) {
95 95
 
Please login to merge, or discard this patch.
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -11,117 +11,117 @@
 block discarded – undo
11 11
 
12 12
 class Application
13 13
 {
14
-  private $container = [];
14
+	private $container = [];
15 15
 
16
-  private static $instance;
16
+	private static $instance;
17 17
 
18
-  public function __construct(File $file)
19
-  {
20
-    $this->handleErrors();
18
+	public function __construct(File $file)
19
+	{
20
+		$this->handleErrors();
21 21
 
22
-    $this->share('file', $file);
22
+		$this->share('file', $file);
23 23
 
24
-    $this->share('config', $this->file->call($this->file->to('config', '.php')));
24
+		$this->share('config', $this->file->call($this->file->to('config', '.php')));
25 25
 
26
-    $this->share('alias', $this->file->call($this->file->to('config/alias', '.php')));
26
+		$this->share('alias', $this->file->call($this->file->to('config/alias', '.php')));
27 27
 
28
-    $this->loadHelpers();
29
-  }
28
+		$this->loadHelpers();
29
+	}
30 30
 
31
-  private function handleErrors() {
31
+	private function handleErrors() {
32 32
 
33
-    $run = new Whoops();
33
+		$run = new Whoops();
34 34
 
35
-    $run->prependHandler(new PrettyPageHandler());
35
+		$run->prependHandler(new PrettyPageHandler());
36 36
 
37
-    if (WhoopsMisc::isAjaxRequest()) {
37
+		if (WhoopsMisc::isAjaxRequest()) {
38 38
 
39
-      $jsonHandler = new JsonResponseHandler();
39
+			$jsonHandler = new JsonResponseHandler();
40 40
 
41
-      $jsonHandler->setJsonApi(true);
41
+			$jsonHandler->setJsonApi(true);
42 42
 
43
-      $run->prependHandler($jsonHandler);
44
-    }
43
+			$run->prependHandler($jsonHandler);
44
+		}
45 45
 
46
-    $run->register();
47
-  }
46
+		$run->register();
47
+	}
48 48
 
49
-  public static function getInstance($file = null)
50
-  {
51
-    return static::$instance = is_null(static::$instance) ? new static($file) : static::$instance;
52
-  }
49
+	public static function getInstance($file = null)
50
+	{
51
+		return static::$instance = is_null(static::$instance) ? new static($file) : static::$instance;
52
+	}
53 53
 
54
-  public function run()
55
-  {
56
-    $this->session->start();
54
+	public function run()
55
+	{
56
+		$this->session->start();
57 57
 
58
-    $this->request->prepareUrl();
58
+		$this->request->prepareUrl();
59 59
 
60
-    $this->file->call($this->file->to('config/constant.php'));
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) $this->file->call($this->file->to($route));
63 63
 
64
-    $output = $this->route->getProperRoute();
64
+		$output = $this->route->getProperRoute();
65 65
 
66
-    $this->response->setOutput($output);
66
+		$this->response->setOutput($output);
67 67
 
68
-    $this->response->send();
69
-  }
68
+		$this->response->send();
69
+	}
70 70
 
71
-  private function loadHelpers()
72
-  {
73
-    $helpers = $this->file->to('Core/helpers', '.php');
71
+	private function loadHelpers()
72
+	{
73
+		$helpers = $this->file->to('Core/helpers', '.php');
74 74
 
75
-    $this->file->call($helpers);
76
-  }
75
+		$this->file->call($helpers);
76
+	}
77 77
 
78
-  public function coreClasses()
79
-  {
80
-    return $this->alias['classes'];
81
-  }
78
+	public function coreClasses()
79
+	{
80
+		return $this->alias['classes'];
81
+	}
82 82
 
83
-  public function share($key, $value)
84
-  {
85
-    if ($value instanceof Closure) $value = call_user_func($value, $this);
83
+	public function share($key, $value)
84
+	{
85
+		if ($value instanceof Closure) $value = call_user_func($value, $this);
86 86
 
87
-    $this->container[$key] = $value;
88
-  }
87
+		$this->container[$key] = $value;
88
+	}
89 89
 
90
-  public function get($key)
91
-  {
92
-    if (! $this->isSharing($key)) {
90
+	public function get($key)
91
+	{
92
+		if (! $this->isSharing($key)) {
93 93
 
94
-      if ($this->isCoreAlias($key)) {
94
+			if ($this->isCoreAlias($key)) {
95 95
 
96
-        $this->share($key, $this->createObject($key));
96
+				$this->share($key, $this->createObject($key));
97 97
 
98
-      } else {
98
+			} else {
99 99
 
100
-        throw new Exception("$key is not found");
101
-      }
102
-    }
103
-    return $this->container[$key];
104
-  }
100
+				throw new Exception("$key is not found");
101
+			}
102
+		}
103
+		return $this->container[$key];
104
+	}
105 105
 
106
-  public function isSharing($key)
107
-  {
108
-    return isset($this->container[$key]);
109
-  }
106
+	public function isSharing($key)
107
+	{
108
+		return isset($this->container[$key]);
109
+	}
110 110
 
111
-  public function isCoreAlias($key)
112
-  {
113
-    return isset($this->coreClasses()[$key]);
114
-  }
111
+	public function isCoreAlias($key)
112
+	{
113
+		return isset($this->coreClasses()[$key]);
114
+	}
115 115
 
116
-  public function createObject($key)
117
-  {
118
-    $object = $this->coreClasses()[$key];
116
+	public function createObject($key)
117
+	{
118
+		$object = $this->coreClasses()[$key];
119 119
 
120
-    return new $object($this);
121
-  }
120
+		return new $object($this);
121
+	}
122 122
 
123
-  public function __get($key)
124
-  {
125
-    return $this->get($key);
126
-  }
123
+	public function __get($key)
124
+	{
125
+		return $this->get($key);
126
+	}
127 127
 }
128 128
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,9 @@  discard block
 block discarded – undo
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
 
@@ -82,7 +84,9 @@  discard block
 block discarded – undo
82 84
 
83 85
   public function share($key, $value)
84 86
   {
85
-    if ($value instanceof Closure) $value = call_user_func($value, $this);
87
+    if ($value instanceof Closure) {
88
+    	$value = call_user_func($value, $this);
89
+    }
86 90
 
87 91
     $this->container[$key] = $value;
88 92
   }
Please login to merge, or discard this patch.
Core/System/Http/Response.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -6,44 +6,44 @@
 block discarded – undo
6 6
 
7 7
 class Response
8 8
 {
9
-  private $app;
10
-
11
-  private $headers = [];
12
-
13
-  private $content = '';
14
-
15
-  public function __construct(Application $app)
16
-  {
17
-    $this->app = $app;
18
-  }
19
-
20
-  public function setOutput($content)
21
-  {
22
-    $this->content = $content;
23
-  }
24
-
25
-  public function setHeaders($header, $value)
26
-  {
27
-    $this->headers[$header] = $value;
28
-  }
29
-
30
-  public function sendOutput()
31
-  {
32
-    echo $this->content;
33
-  }
34
-
35
-  public function sendHeaders()
36
-  {
37
-    foreach($this->headers as $header => $value)
38
-    {
39
-      header($header . ':' . $value);
40
-    }
41
-  }
42
-
43
-  public function send()
44
-  {
45
-    $this->sendHeaders();
46
-
47
-    $this->sendOutput();
48
-  }
9
+	private $app;
10
+
11
+	private $headers = [];
12
+
13
+	private $content = '';
14
+
15
+	public function __construct(Application $app)
16
+	{
17
+		$this->app = $app;
18
+	}
19
+
20
+	public function setOutput($content)
21
+	{
22
+		$this->content = $content;
23
+	}
24
+
25
+	public function setHeaders($header, $value)
26
+	{
27
+		$this->headers[$header] = $value;
28
+	}
29
+
30
+	public function sendOutput()
31
+	{
32
+		echo $this->content;
33
+	}
34
+
35
+	public function sendHeaders()
36
+	{
37
+		foreach($this->headers as $header => $value)
38
+		{
39
+			header($header . ':' . $value);
40
+		}
41
+	}
42
+
43
+	public function send()
44
+	{
45
+		$this->sendHeaders();
46
+
47
+		$this->sendOutput();
48
+	}
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
Core/System/Paginatio.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
   {
26 26
     $page = $this->app->request->get('page');
27 27
 
28
-    if (! is_numeric($page) || $page < 1) {
28
+    if (!is_numeric($page) || $page < 1) {
29 29
       $page = 1;
30 30
     }
31 31
 
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -4,87 +4,87 @@
 block discarded – undo
4 4
 
5 5
 class Pagination
6 6
 {
7
-  private $app;
7
+	private $app;
8 8
 
9
-  private $totalItems;
9
+	private $totalItems;
10 10
 
11
-  private $itemsPerPage = 10;
11
+	private $itemsPerPage = 10;
12 12
 
13
-  private $lastPage;
13
+	private $lastPage;
14 14
 
15
-  private $page = 1;
15
+	private $page = 1;
16 16
 
17
-  public function __construct(Application $app)
18
-  {
19
-    $this->app = $app;
17
+	public function __construct(Application $app)
18
+	{
19
+		$this->app = $app;
20 20
 
21
-    $this->setCurrentPage();
22
-  }
21
+		$this->setCurrentPage();
22
+	}
23 23
 
24
-  private function setCurrentPage()
25
-  {
26
-    $page = $this->app->request->get('page');
24
+	private function setCurrentPage()
25
+	{
26
+		$page = $this->app->request->get('page');
27 27
 
28
-    if (! is_numeric($page) || $page < 1) {
29
-      $page = 1;
30
-    }
28
+		if (! is_numeric($page) || $page < 1) {
29
+			$page = 1;
30
+		}
31 31
 
32
-    $this->page = $page;
33
-  }
32
+		$this->page = $page;
33
+	}
34 34
 
35
-  public function page()
36
-  {
37
-    return $this->page;
38
-  }
35
+	public function page()
36
+	{
37
+		return $this->page;
38
+	}
39 39
 
40
-  public function itemsPerPage()
41
-  {
42
-    return $this->itemsPerPage;
43
-  }
40
+	public function itemsPerPage()
41
+	{
42
+		return $this->itemsPerPage;
43
+	}
44 44
 
45
-  public function totalItems()
46
-  {
47
-    return $this->totalItems;
48
-  }
45
+	public function totalItems()
46
+	{
47
+		return $this->totalItems;
48
+	}
49 49
 
50
-  public function last()
51
-  {
52
-    return $this->lastPage;
53
-  }
50
+	public function last()
51
+	{
52
+		return $this->lastPage;
53
+	}
54 54
 
55
-  public function next()
56
-  {
57
-    return $this->page + 1;
58
-  }
55
+	public function next()
56
+	{
57
+		return $this->page + 1;
58
+	}
59 59
 
60
-  public function prev()
61
-  {
62
-    return $this->page - 1;
63
-  }
60
+	public function prev()
61
+	{
62
+		return $this->page - 1;
63
+	}
64 64
 
65
-  public function setTotalItems($totalItems)
66
-  {
67
-    $this->totalItems = $totalItems;
65
+	public function setTotalItems($totalItems)
66
+	{
67
+		$this->totalItems = $totalItems;
68 68
 
69
-    return $this;
70
-  }
69
+		return $this;
70
+	}
71 71
 
72
-  public function setItemsPerPage($itemsPerPage)
73
-  {
74
-    $this->itemsPerPage = $itemsPerPage;
72
+	public function setItemsPerPage($itemsPerPage)
73
+	{
74
+		$this->itemsPerPage = $itemsPerPage;
75 75
 
76
-    return $this;
77
-  }
76
+		return $this;
77
+	}
78 78
 
79
-  public function paginate()
80
-  {
81
-    $this->setLastPage();
79
+	public function paginate()
80
+	{
81
+		$this->setLastPage();
82 82
 
83
-    return $this;
84
-  }
83
+		return $this;
84
+	}
85 85
 
86
-  private function setLastPage()
87
-  {
88
-    $this->lastPage = ceil($this->totalItems / $this->itemsPerPage);
89
-  }
86
+	private function setLastPage()
87
+	{
88
+		$this->lastPage = ceil($this->totalItems / $this->itemsPerPage);
89
+	}
90 90
 }
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
App/Middleware/Admin/RedirectMiddleware.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
   public function handle(Application $app, $next)
11 11
   {
12 12
 
13
-    if (! $this->session->has('error') || $this->session->get('error') != true) {
13
+    if (!$this->session->has('error') || $this->session->get('error') != true) {
14 14
 
15 15
       $this->url->redirectTo('/');
16 16
 
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@
 block discarded – undo
7 7
 
8 8
 class RedirectMiddleware implements Middleware
9 9
 {
10
-  public function handle(Application $app, $next)
11
-  {
10
+	public function handle(Application $app, $next)
11
+	{
12 12
 
13
-    if (! $this->session->has('error') || $this->session->get('error') != true) {
13
+		if (! $this->session->has('error') || $this->session->get('error') != true) {
14 14
 
15
-      $this->url->redirectTo('/');
15
+			$this->url->redirectTo('/');
16 16
 
17
-    } else {
17
+		} else {
18 18
 
19
-      $this->session->remove('error');
20
-    }
21
-  }
19
+			$this->session->remove('error');
20
+		}
21
+	}
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
Core/System/Http/Request.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -6,136 +6,136 @@
 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, '?')) list($requestUri, $queryString) = explode('?', $requestUri);
30
+		if (strpos($requestUri, '?')) list($requestUri, $queryString) = explode('?', $requestUri);
31 31
 
32
-    if (! in_array($script, ['/', '\\'])) {
32
+		if (! in_array($script, ['/', '\\'])) {
33 33
 
34
-      $this->url = preg_replace('#^' . $script . '#', '', $requestUri);
35
-    } else {
34
+			$this->url = preg_replace('#^' . $script . '#', '', $requestUri);
35
+		} else {
36 36
 
37
-      $this->url = $requestUri;
38
-    }
37
+			$this->url = $requestUri;
38
+		}
39 39
 
40
-    if ($this->url !== '/') $this->url = rtrim($this->url, '/');
40
+		if ($this->url !== '/') $this->url = rtrim($this->url, '/');
41 41
 
42
-    $isSecure = false;
42
+		$isSecure = false;
43 43
 
44
-    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
44
+		if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
45 45
 
46
-      $isSecure = true;
46
+			$isSecure = true;
47 47
 
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')) {
50
-      $isSecure = true;
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')) {
50
+			$isSecure = true;
51
+		}
52 52
 
53
-    $REQUEST_PROTOCOL = $isSecure ? 'https' : 'http';
53
+		$REQUEST_PROTOCOL = $isSecure ? 'https' : 'http';
54 54
 
55
-    $this->link = $REQUEST_PROTOCOL . '://' . $this->server('HTTP_HOST');
55
+		$this->link = $REQUEST_PROTOCOL . '://' . $this->server('HTTP_HOST');
56 56
 
57
-    $this->baseUrl = $this->link . $requestUri;
58
-  }
57
+		$this->baseUrl = $this->link . $requestUri;
58
+	}
59 59
 
60
-  public function get($key)
61
-  {
62
-    $value = array_get($_GET, $key);
60
+	public function get($key)
61
+	{
62
+		$value = array_get($_GET, $key);
63 63
 
64
-    if (is_array($value)) {
65
-      $value = array_filter($value);
66
-    } else {
67
-      $value = trim($value);
68
-    }
64
+		if (is_array($value)) {
65
+			$value = array_filter($value);
66
+		} else {
67
+			$value = trim($value);
68
+		}
69 69
 
70
-    return $value;
71
-  }
70
+		return $value;
71
+	}
72 72
 
73
-  public function post($key)
74
-  {
75
-    $value = array_get($_POST, $key);
73
+	public function post($key)
74
+	{
75
+		$value = array_get($_POST, $key);
76 76
 
77
-    if (is_array($value)) {
78
-      $value = array_filter($value);
79
-    } else {
80
-      $value = trim($value);
81
-    }
77
+		if (is_array($value)) {
78
+			$value = array_filter($value);
79
+		} else {
80
+			$value = trim($value);
81
+		}
82 82
 
83
-    return $value;
84
-  }
83
+		return $value;
84
+	}
85 85
 
86
-  public function setPost($key, $value)
87
-  {
88
-    $_POST[$key] = $value;
89
-  }
86
+	public function setPost($key, $value)
87
+	{
88
+		$_POST[$key] = $value;
89
+	}
90 90
 
91
-  public function posts()
92
-  {
93
-    return $_POST;
94
-  }
91
+	public function posts()
92
+	{
93
+		return $_POST;
94
+	}
95 95
 
96
-  public function files()
97
-  {
98
-    return $_FILES;
99
-  }
96
+	public function files()
97
+	{
98
+		return $_FILES;
99
+	}
100 100
 
101
-  public function file($input)
102
-  {
103
-    if (isset($this->files[$input])) return $this->files[$input];
101
+	public function file($input)
102
+	{
103
+		if (isset($this->files[$input])) return $this->files[$input];
104 104
 
105
-    $upoadedFile = new UploadeFile($this->app, $input);
105
+		$upoadedFile = new UploadeFile($this->app, $input);
106 106
 
107
-    $this->files[$input] = $upoadedFile;
107
+		$this->files[$input] = $upoadedFile;
108 108
 
109
-    return $this->files[$input];
110
-  }
109
+		return $this->files[$input];
110
+	}
111 111
 
112
-  public function server($key)
113
-  {
114
-    return array_get($_SERVER, $key);
115
-  }
112
+	public function server($key)
113
+	{
114
+		return array_get($_SERVER, $key);
115
+	}
116 116
 
117
-  public function method()
118
-  {
119
-    return $this->server('REQUEST_METHOD');
120
-  }
117
+	public function method()
118
+	{
119
+		return $this->server('REQUEST_METHOD');
120
+	}
121 121
 
122
-  public function referer()
123
-  {
124
-    return $this->server('HTTP_REFERER');
125
-  }
122
+	public function referer()
123
+	{
124
+		return $this->server('HTTP_REFERER');
125
+	}
126 126
 
127
-  public function baseUrl()
128
-  {
129
-    return $this->baseUrl;
130
-  }
127
+	public function baseUrl()
128
+	{
129
+		return $this->baseUrl;
130
+	}
131 131
 
132
-  public function url()
133
-  {
134
-    return $this->url;
135
-  }
132
+	public function url()
133
+	{
134
+		return $this->url;
135
+	}
136 136
 
137
-  public function link()
138
-  {
139
-    return $this->link;
140
-  }
137
+	public function link()
138
+	{
139
+		return $this->link;
140
+	}
141 141
 }
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
@@ -100,7 +103,9 @@  discard block
 block discarded – undo
100 103
 
101 104
   public function file($input)
102 105
   {
103
-    if (isset($this->files[$input])) return $this->files[$input];
106
+    if (isset($this->files[$input])) {
107
+    	return $this->files[$input];
108
+    }
104 109
 
105 110
     $upoadedFile = new UploadeFile($this->app, $input);
106 111
 
Please login to merge, or discard this patch.
Core/System/Database.php 3 patches
Spacing   +7 added lines, -7 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,9 +94,9 @@  discard block
 block discarded – undo
94 94
 
95 95
   public function join($join, $localId = null, $forginId = null)
96 96
   {
97
-    if (! $localId)  $localId =  trim($join, 's' ). '_id';
97
+    if (!$localId)  $localId = trim($join, 's') . '_id';
98 98
 
99
-    if (! $forginId) $forginId =  'id';
99
+    if (!$forginId) $forginId = 'id';
100 100
 
101 101
     $sql = $join . ' ON ' . $this->table . '.' . $localId . ' = ' . $join . '.' . $forginId;
102 102
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
     if (!empty($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
 block discarded – undo
232 232
     }
233 233
 
234 234
     if (!empty($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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Indentation   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -8,394 +8,394 @@
 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)  $localId =  trim($join, 's' ). '_id';
95
+	public function join($join, $localId = null, $forginId = null)
96
+	{
97
+		if (! $localId)  $localId =  trim($join, 's' ). '_id';
98 98
 
99
-    if (! $forginId) $forginId =  'id';
99
+		if (! $forginId) $forginId =  'id';
100 100
 
101
-    $sql = $join . ' ON ' . $this->table . '.' . $localId . ' = ' . $join . '.' . $forginId;
101
+		$sql = $join . ' ON ' . $this->table . '.' . $localId . ' = ' . $join . '.' . $forginId;
102 102
 
103
-    $this->joins[] = $sql;
103
+		$this->joins[] = $sql;
104 104
 
105
-    return $this;
106
-  }
105
+		return $this;
106
+	}
107 107
 
108
-  public function where(...$bindings)
109
-  {
110
-    $sql = array_shift($bindings);
108
+	public function where(...$bindings)
109
+	{
110
+		$sql = array_shift($bindings);
111 111
 
112
-    if (is_array($bindings[0])) $bindings = $bindings[0];
112
+		if (is_array($bindings[0])) $bindings = $bindings[0];
113 113
 
114
-    $this->addToBindings($bindings);
114
+		$this->addToBindings($bindings);
115 115
 
116
-    $this->wheres[] = $sql;
116
+		$this->wheres[] = $sql;
117 117
 
118
-    return $this;
119
-  }
118
+		return $this;
119
+	}
120 120
 
121
-  public function having()
122
-  {
123
-    $bindings = func_get_args();
121
+	public function having()
122
+	{
123
+		$bindings = func_get_args();
124 124
 
125
-    $sql = array_shift($bindings);
125
+		$sql = array_shift($bindings);
126 126
 
127
-    $this->addToBindings($bindings);
127
+		$this->addToBindings($bindings);
128 128
 
129
-    $this->havings[] = $sql;
129
+		$this->havings[] = $sql;
130 130
 
131
-    return $this;
132
-  }
131
+		return $this;
132
+	}
133 133
 
134
-  public function groupBy(...$arguments)
135
-  {
136
-    $this->groupBy = $arguments;
134
+	public function groupBy(...$arguments)
135
+	{
136
+		$this->groupBy = $arguments;
137 137
 
138
-    return $this;
139
-  }
138
+		return $this;
139
+	}
140 140
 
141
-  public function limit($limit, $offset = 0)
142
-  {
143
-    $this->limit = $limit;
141
+	public function limit($limit, $offset = 0)
142
+	{
143
+		$this->limit = $limit;
144 144
 
145
-    $this->offset = $offset;
145
+		$this->offset = $offset;
146 146
 
147
-    return $this;
148
-  }
147
+		return $this;
148
+	}
149 149
 
150
-  public function rows()
151
-  {
152
-    return $this->rows;
153
-  }
150
+	public function rows()
151
+	{
152
+		return $this->rows;
153
+	}
154 154
 
155
-  public function orderBy($orderBy, $sort = 'ASC')
156
-  {
157
-    $this->orderBy = [$orderBy, $sort];
155
+	public function orderBy($orderBy, $sort = 'ASC')
156
+	{
157
+		$this->orderBy = [$orderBy, $sort];
158 158
 
159
-    return $this;
160
-  }
159
+		return $this;
160
+	}
161 161
 
162
-  public function fetch($table = null)
163
-  {
164
-    if ($table) {
165
-      $this->table($table);
166
-    }
162
+	public function fetch($table = null)
163
+	{
164
+		if ($table) {
165
+			$this->table($table);
166
+		}
167 167
 
168
-    $sql = $this->fetchStatment();
168
+		$sql = $this->fetchStatment();
169 169
 
170
-    $query = $this->query($sql, $this->bindings);
170
+		$query = $this->query($sql, $this->bindings);
171 171
 
172
-    $result = $query->fetch();
172
+		$result = $query->fetch();
173 173
 
174
-    $this->rows = $query->rowCount();
174
+		$this->rows = $query->rowCount();
175 175
 
176
-    return $result;
177
-  }
176
+		return $result;
177
+	}
178 178
 
179
-  public function fetchAll($table = null)
180
-  {
181
-    if ($table) {
182
-      $this->table($table);
183
-    }
179
+	public function fetchAll($table = null)
180
+	{
181
+		if ($table) {
182
+			$this->table($table);
183
+		}
184 184
 
185
-    $sql = $this->fetchStatment();
185
+		$sql = $this->fetchStatment();
186 186
 
187
-    $query = $this->query($sql, $this->bindings);
187
+		$query = $this->query($sql, $this->bindings);
188 188
 
189
-    $results = $query->fetchall();
189
+		$results = $query->fetchall();
190 190
 
191
-    $this->rows = $query->rowCount();
191
+		$this->rows = $query->rowCount();
192 192
 
193
-    return $results;
194
-  }
193
+		return $results;
194
+	}
195 195
 
196
-  private function fetchStatment()
197
-  {
198
-    $sql = 'SELECT ';
196
+	private function fetchStatment()
197
+	{
198
+		$sql = 'SELECT ';
199 199
 
200
-    $sql .= $this->selects ? implode(', ', $this->selects) : '*';
200
+		$sql .= $this->selects ? implode(', ', $this->selects) : '*';
201 201
 
202
-    $sql .= ' FROM ' . $this->table . ' ';
202
+		$sql .= ' FROM ' . $this->table . ' ';
203 203
 
204
-    if (!empty($this->joins)) {
204
+		if (!empty($this->joins)) {
205 205
 
206
-      $sql .= 'LEFT JOIN ' . implode(' ', $this->joins);
207
-    }
206
+			$sql .= 'LEFT JOIN ' . implode(' ', $this->joins);
207
+		}
208 208
 
209
-    if (!empty($this->wheres)) {
209
+		if (!empty($this->wheres)) {
210 210
 
211
-      $sql .= ' WHERE ' . implode(' ', $this->wheres);
212
-    }
211
+			$sql .= ' WHERE ' . implode(' ', $this->wheres);
212
+		}
213 213
 
214
-    if (!empty($this->havings)) {
214
+		if (!empty($this->havings)) {
215 215
 
216
-      $sql .= ' HAVING ' . implode(' ', $this->havings) . ' ';
217
-    }
216
+			$sql .= ' HAVING ' . implode(' ', $this->havings) . ' ';
217
+		}
218 218
 
219
-    if (!empty($this->orderBy)) {
219
+		if (!empty($this->orderBy)) {
220 220
 
221
-      $sql .= ' ORDER BY ' . implode (' ', $this->orderBy);
222
-    }
221
+			$sql .= ' ORDER BY ' . implode (' ', $this->orderBy);
222
+		}
223 223
 
224
-    if ($this->limit) {
224
+		if ($this->limit) {
225 225
 
226
-      $sql .= ' LIMIT ' . $this->limit;
227
-    }
226
+			$sql .= ' LIMIT ' . $this->limit;
227
+		}
228 228
 
229
-    if ($this->offset) {
229
+		if ($this->offset) {
230 230
 
231
-      $sql .= ' OFFSET ' . $this->offset;
232
-    }
231
+			$sql .= ' OFFSET ' . $this->offset;
232
+		}
233 233
 
234
-    if (!empty($this->groupBy)) {
235
-      $sql .= ' GROUP BY ' . implode(' ' , $this->groupBy);
236
-    }
234
+		if (!empty($this->groupBy)) {
235
+			$sql .= ' GROUP BY ' . implode(' ' , $this->groupBy);
236
+		}
237 237
 
238
-    return $sql;
239
-  }
238
+		return $sql;
239
+	}
240 240
 
241
-  public function lastId()
242
-  {
243
-    return $this->lastId;
244
-  }
241
+	public function lastId()
242
+	{
243
+		return $this->lastId;
244
+	}
245 245
 
246
-  public function from($table)
247
-  {
248
-    return $this->table($table);
249
-  }
246
+	public function from($table)
247
+	{
248
+		return $this->table($table);
249
+	}
250 250
 
251
-  public function data($key, $value = null)
252
-  {
253
-    if (is_array($key)) {
251
+	public function data($key, $value = null)
252
+	{
253
+		if (is_array($key)) {
254 254
 
255
-      $this->data = array_merge($this->data, $key);
255
+			$this->data = array_merge($this->data, $key);
256 256
 
257
-      $this->addToBindings($key);
257
+			$this->addToBindings($key);
258 258
 
259
-    } else {
259
+		} else {
260 260
 
261
-      $this->data[$key] = $value;
261
+			$this->data[$key] = $value;
262 262
 
263
-      $this->addToBindings($value);
263
+			$this->addToBindings($value);
264 264
 
265
-    }
265
+		}
266 266
 
267
-    return $this;
268
-  }
267
+		return $this;
268
+	}
269 269
 
270
-  public function insert($table = null)
271
-  {
272
-    if ($table) {
273
-      $this->table($table);
274
-    }
270
+	public function insert($table = null)
271
+	{
272
+		if ($table) {
273
+			$this->table($table);
274
+		}
275 275
 
276
-    $sql = 'INSERT INTO ' . $this->table . ' SET ';
276
+		$sql = 'INSERT INTO ' . $this->table . ' SET ';
277 277
 
278
-    $sql .= $this->setField();
278
+		$sql .= $this->setField();
279 279
 
280
-    $this->query($sql, $this->bindings);
280
+		$this->query($sql, $this->bindings);
281 281
 
282
-    $this->lastId = $this->connection()->lastInsertId();
282
+		$this->lastId = $this->connection()->lastInsertId();
283 283
 
284
-    return $this;
285
-  }
284
+		return $this;
285
+	}
286 286
 
287
-  public function update($table = null)
288
-  {
289
-    if ($table) {
290
-      $this->table($table);
291
-    }
287
+	public function update($table = null)
288
+	{
289
+		if ($table) {
290
+			$this->table($table);
291
+		}
292 292
 
293
-    $sql = 'UPDATE ' . $this->table . ' SET ';
293
+		$sql = 'UPDATE ' . $this->table . ' SET ';
294 294
 
295
-    $sql .= $this->setField();
295
+		$sql .= $this->setField();
296 296
 
297
-    if (!empty($this->wheres)) {
298
-      $sql .= ' WHERE ' . implode('', $this->wheres);
299
-    }
297
+		if (!empty($this->wheres)) {
298
+			$sql .= ' WHERE ' . implode('', $this->wheres);
299
+		}
300 300
 
301
-    $this->query($sql, $this->bindings);
301
+		$this->query($sql, $this->bindings);
302 302
 
303
-    return $this;
304
-  }
303
+		return $this;
304
+	}
305 305
 
306
-  public function delete($table = null)
307
-  {
308
-    if ($table) {
309
-      $this->table($table);
310
-    }
306
+	public function delete($table = null)
307
+	{
308
+		if ($table) {
309
+			$this->table($table);
310
+		}
311 311
 
312
-    $sql = 'DELETE FROM ' . $this->table . ' ';
312
+		$sql = 'DELETE FROM ' . $this->table . ' ';
313 313
 
314
-    if (!empty($this->wheres)) {
315
-      $sql .= ' WHERE ' . implode('', $this->wheres);
316
-    }
314
+		if (!empty($this->wheres)) {
315
+			$sql .= ' WHERE ' . implode('', $this->wheres);
316
+		}
317 317
 
318
-    $this->query($sql, $this->bindings);
318
+		$this->query($sql, $this->bindings);
319 319
 
320
-    return $this;
321
-  }
320
+		return $this;
321
+	}
322 322
 
323
-  private function setField()
324
-  {
325
-    $sql = '';
323
+	private function setField()
324
+	{
325
+		$sql = '';
326 326
 
327
-    foreach($this->data as $key => $value) {
327
+		foreach($this->data as $key => $value) {
328 328
 
329
-      $sql .= '`' . $key . '` = ? ,';
330
-    }
329
+			$sql .= '`' . $key . '` = ? ,';
330
+		}
331 331
 
332
-    $sql = rtrim($sql, ' ,');
332
+		$sql = rtrim($sql, ' ,');
333 333
 
334
-    return $sql;
335
-  }
334
+		return $sql;
335
+	}
336 336
 
337
-  private function addToBindings($value)
338
-  {
339
-    if (is_array($value)) {
337
+	private function addToBindings($value)
338
+	{
339
+		if (is_array($value)) {
340 340
 
341
-      $this->bindings = array_merge($this->bindings, array_values($value));
342
-    } else {
341
+			$this->bindings = array_merge($this->bindings, array_values($value));
342
+		} else {
343 343
 
344
-      $this->bindings[] = $value;
345
-    }
346
-  }
344
+			$this->bindings[] = $value;
345
+		}
346
+	}
347 347
 
348
-  public function query(...$bindings)
349
-  {
350
-    $sql = array_shift($bindings);
348
+	public function query(...$bindings)
349
+	{
350
+		$sql = array_shift($bindings);
351 351
 
352
-    if (count($bindings) == 1 AND is_array($bindings[0])) {
353
-      $bindings = $bindings[0];
354
-    }
352
+		if (count($bindings) == 1 AND is_array($bindings[0])) {
353
+			$bindings = $bindings[0];
354
+		}
355 355
 
356
-    try {
357
-        $query = $this->connection()->prepare($sql);
356
+		try {
357
+				$query = $this->connection()->prepare($sql);
358 358
 
359
-        foreach ($bindings as $key => $value) {
360
-          $query->bindValue($key + 1, _e($value));
361
-        }
359
+				foreach ($bindings as $key => $value) {
360
+					$query->bindValue($key + 1, _e($value));
361
+				}
362 362
 
363
-        $query->execute();
363
+				$query->execute();
364 364
 
365
-        $this->reset();
365
+				$this->reset();
366 366
 
367
-        return $query;
367
+				return $query;
368 368
 
369
-    } catch (PDOException $e) {
369
+		} catch (PDOException $e) {
370 370
 
371
-      throw new Exception($e->getMessage());
372
-    }
373
-  }
371
+			throw new Exception($e->getMessage());
372
+		}
373
+	}
374 374
 
375
-  private function reset()
376
-  {
377
-    $this->table = null;
375
+	private function reset()
376
+	{
377
+		$this->table = null;
378 378
 
379
-    $this->rows = 0;
379
+		$this->rows = 0;
380 380
 
381
-    $this->data = [];
381
+		$this->data = [];
382 382
 
383
-    $this->bindings = [];
383
+		$this->bindings = [];
384 384
 
385
-    $this->selects = [];
385
+		$this->selects = [];
386 386
 
387
-    $this->joins = [];
387
+		$this->joins = [];
388 388
 
389
-    $this->wheres = [];
389
+		$this->wheres = [];
390 390
 
391
-    $this->havings = [];
391
+		$this->havings = [];
392 392
 
393
-    $this->orderBy = [];
393
+		$this->orderBy = [];
394 394
 
395
-    $this->limit = null;
395
+		$this->limit = null;
396 396
 
397
-    $this->offset = 0;
397
+		$this->offset = 0;
398 398
 
399
-    $this->groupBy = [];
400
-  }
399
+		$this->groupBy = [];
400
+	}
401 401
 }
402 402
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -94,9 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
   public function join($join, $localId = null, $forginId = null)
96 96
   {
97
-    if (! $localId)  $localId =  trim($join, 's' ). '_id';
97
+    if (! $localId) {
98
+    	$localId =  trim($join, 's' ). '_id';
99
+    }
98 100
 
99
-    if (! $forginId) $forginId =  'id';
101
+    if (! $forginId) {
102
+    	$forginId =  'id';
103
+    }
100 104
 
101 105
     $sql = $join . ' ON ' . $this->table . '.' . $localId . ' = ' . $join . '.' . $forginId;
102 106
 
@@ -109,7 +113,9 @@  discard block
 block discarded – undo
109 113
   {
110 114
     $sql = array_shift($bindings);
111 115
 
112
-    if (is_array($bindings[0])) $bindings = $bindings[0];
116
+    if (is_array($bindings[0])) {
117
+    	$bindings = $bindings[0];
118
+    }
113 119
 
114 120
     $this->addToBindings($bindings);
115 121
 
Please login to merge, or discard this patch.