Passed
Push — master ( 324022...c1dc8a )
by refat
03:19
created
Core/System/Url.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,28 +4,28 @@
 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
-  {
9
+    public function __construct(Application $app)
10
+    {
11 11
     $this->app = $app;
12
-  }
12
+    }
13 13
 
14
-  public function link($path)
15
-  {
14
+    public function link($path)
15
+    {
16 16
     $link = $this->app->request->link();
17 17
 
18 18
     $path = rtrim($path, '/');
19 19
     $path = ltrim($path, '/');
20 20
 
21 21
     return $link . '/' . $path;
22
-  }
22
+    }
23 23
 
24
-  public function redirectTo($path, $num = 0)
25
-  {
24
+    public function redirectTo($path, $num = 0)
25
+    {
26 26
     if ($path == 'error') $this->app->session->set('error', true);
27 27
 
28 28
     header('Refresh: ' . $num . '; URL=' . $this->link($path));
29 29
     exit;
30
-  }
30
+    }
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 
24 24
   public function redirectTo($path, $num = 0)
25 25
   {
26
-    if ($path == 'error') $this->app->session->set('error', true);
26
+    if ($path == 'error') {
27
+        $this->app->session->set('error', true);
28
+    }
27 29
 
28 30
     header('Refresh: ' . $num . '; URL=' . $this->link($path));
29 31
     exit;
Please login to merge, or discard this patch.
Core/helpers.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -3,75 +3,75 @@  discard block
 block discarded – undo
3 3
 use System\Application;
4 4
 
5 5
 if (! function_exists('pre')) {
6
-  function pre($var) {
6
+    function pre($var) {
7 7
     echo '<pre>';
8 8
     print_r($var);
9 9
     echo '</pre>';
10
-  }
10
+    }
11 11
 }
12 12
 
13 13
 if (! function_exists('array_get')) {
14
-  function array_get($array, $key, $default = null)
15
-  {
14
+    function array_get($array, $key, $default = null)
15
+    {
16 16
     return $array[$key] ?: $default;
17
-  }
17
+    }
18 18
 }
19 19
 
20 20
 if (! function_exists('app')) {
21
-  function app()
22
-  {
21
+    function app()
22
+    {
23 23
     return Application::getInstance();
24
-  }
24
+    }
25 25
 }
26 26
 
27 27
 if (! function_exists('_e')) {
28
-  function _e($value)
29
-  {
28
+    function _e($value)
29
+    {
30 30
     return htmlspecialchars($value);
31
-  }
31
+    }
32 32
 }
33 33
 
34 34
 if (! function_exists('getLastIndex')) {
35
-  function getLastIndex($index)
36
-  {
35
+    function getLastIndex($index)
36
+    {
37 37
     $array = explode('\\', $index);
38 38
     return end($array);
39
-  }
39
+    }
40 40
 }
41 41
 
42 42
 if (! function_exists('url')) {
43
-  function url($path) {
43
+    function url($path) {
44 44
     $app = Application::getInstance();
45 45
     return $app->url->link($path);
46
-  }
46
+    }
47 47
 }
48 48
 
49 49
 if (! function_exists('assets')) {
50
-  function assets($path)
51
-  {
50
+    function assets($path)
51
+    {
52 52
     $app = Application::getInstance();
53 53
     return $app->url->link('public' . DS . $path);
54
-  }
54
+    }
55 55
 }
56 56
 
57 57
 if (! function_exists('remove_space')) {
58
-  function remove_space($str) {
58
+    function remove_space($str) {
59 59
     return str_replace(' ', '-', $str);
60
-  }
60
+    }
61 61
 }
62 62
 
63 63
 if (! function_exists('remove_dash')) {
64
-  function remove_dash($str) {
64
+    function remove_dash($str) {
65 65
     return str_replace('-', ' ', $str);
66
-  }
66
+    }
67 67
 }
68 68
 
69 69
 if (! function_exists('clean_name_url')) {
70 70
     function clean_name_url($class = null) {
71 71
 
72
-      $app = Application::getInstance();
72
+        $app = Application::getInstance();
73 73
 
74
-      if (! $class) {
74
+        if (! $class) {
75 75
 
76 76
         $class = debug_backtrace()[1]['class'];
77 77
 
@@ -84,40 +84,40 @@  discard block
 block discarded – undo
84 84
         $class = strtolower($class);
85 85
 
86 86
         $class = '/' . $class .  '/';
87
-      }
87
+        }
88 88
 
89
-      $url = $app->request->url();
89
+        $url = $app->request->url();
90 90
 
91
-      $name = str_replace($class, '', $url);
91
+        $name = str_replace($class, '', $url);
92 92
 
93
-      $name = remove_dash($name);
93
+        $name = remove_dash($name);
94 94
 
95
-      return $name;
96
-  }
95
+        return $name;
96
+    }
97 97
 }
98 98
 
99 99
 if (! function_exists('text_char_limit')) {
100
-  function text_char_limit($text, $limit) {
100
+    function text_char_limit($text, $limit) {
101 101
     if (strlen($text) > $limit) {
102
-      return substr($text, 0, $limit) . '...';
102
+        return substr($text, 0, $limit) . '...';
103
+    }
103 104
     }
104
-  }
105 105
 }
106 106
 
107 107
 if (! function_exists('array_equal')) {
108
-  function array_equal($a, $b) {
108
+    function array_equal($a, $b) {
109 109
     return (
110
-      is_array($a)
110
+        is_array($a)
111 111
       && is_array($b)
112 112
       && count($a) == count($b)
113 113
       && array_diff($a, $b) === array_diff($b, $a)
114 114
     );
115
-  }
115
+    }
116 116
 }
117 117
 
118 118
 if (! function_exists('redirect_after')) {
119
-  function redirect_after($num) {
119
+    function redirect_after($num) {
120 120
     $app = Application::getInstance();
121 121
     $app->url->redirectTo('/', $num);
122
-  }
122
+    }
123 123
 }
124 124
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use System\Application;
4 4
 
5
-if (! function_exists('pre')) {
5
+if (!function_exists('pre')) {
6 6
   function pre($var) {
7 7
     echo '<pre>';
8 8
     print_r($var);
@@ -10,28 +10,28 @@  discard block
 block discarded – undo
10 10
   }
11 11
 }
12 12
 
13
-if (! function_exists('array_get')) {
13
+if (!function_exists('array_get')) {
14 14
   function array_get($array, $key, $default = null)
15 15
   {
16 16
     return $array[$key] ?: $default;
17 17
   }
18 18
 }
19 19
 
20
-if (! function_exists('app')) {
20
+if (!function_exists('app')) {
21 21
   function app()
22 22
   {
23 23
     return Application::getInstance();
24 24
   }
25 25
 }
26 26
 
27
-if (! function_exists('_e')) {
27
+if (!function_exists('_e')) {
28 28
   function _e($value)
29 29
   {
30 30
     return htmlspecialchars($value);
31 31
   }
32 32
 }
33 33
 
34
-if (! function_exists('getLastIndex')) {
34
+if (!function_exists('getLastIndex')) {
35 35
   function getLastIndex($index)
36 36
   {
37 37
     $array = explode('\\', $index);
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
   }
40 40
 }
41 41
 
42
-if (! function_exists('url')) {
42
+if (!function_exists('url')) {
43 43
   function url($path) {
44 44
     $app = Application::getInstance();
45 45
     return $app->url->link($path);
46 46
   }
47 47
 }
48 48
 
49
-if (! function_exists('assets')) {
49
+if (!function_exists('assets')) {
50 50
   function assets($path)
51 51
   {
52 52
     $app = Application::getInstance();
@@ -54,24 +54,24 @@  discard block
 block discarded – undo
54 54
   }
55 55
 }
56 56
 
57
-if (! function_exists('remove_space')) {
57
+if (!function_exists('remove_space')) {
58 58
   function remove_space($str) {
59 59
     return str_replace(' ', '-', $str);
60 60
   }
61 61
 }
62 62
 
63
-if (! function_exists('remove_dash')) {
63
+if (!function_exists('remove_dash')) {
64 64
   function remove_dash($str) {
65 65
     return str_replace('-', ' ', $str);
66 66
   }
67 67
 }
68 68
 
69
-if (! function_exists('clean_name_url')) {
69
+if (!function_exists('clean_name_url')) {
70 70
     function clean_name_url($class = null) {
71 71
 
72 72
       $app = Application::getInstance();
73 73
 
74
-      if (! $class) {
74
+      if (!$class) {
75 75
 
76 76
         $class = debug_backtrace()[1]['class'];
77 77
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
         $class = strtolower($class);
85 85
 
86
-        $class = '/' . $class .  '/';
86
+        $class = '/' . $class . '/';
87 87
       }
88 88
 
89 89
       $url = $app->request->url();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
   }
97 97
 }
98 98
 
99
-if (! function_exists('text_char_limit')) {
99
+if (!function_exists('text_char_limit')) {
100 100
   function text_char_limit($text, $limit) {
101 101
     if (strlen($text) > $limit) {
102 102
       return substr($text, 0, $limit) . '...';
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
   }
105 105
 }
106 106
 
107
-if (! function_exists('array_equal')) {
107
+if (!function_exists('array_equal')) {
108 108
   function array_equal($a, $b) {
109 109
     return (
110 110
       is_array($a)
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
   }
116 116
 }
117 117
 
118
-if (! function_exists('redirect_after')) {
118
+if (!function_exists('redirect_after')) {
119 119
   function redirect_after($num) {
120 120
     $app = Application::getInstance();
121 121
     $app->url->redirectTo('/', $num);
Please login to merge, or discard this patch.
config/alias.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-  'classes' => [
4
+    'classes' => [
5 5
     'request'   =>  'System\\Http\\Request',
6 6
     'response'  =>  'System\\Http\\Response',
7 7
     'route'     =>  'System\\Route',
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
     'validator' =>  'System\\Validation',
15 15
     'paginatio' =>  'System\\Paginatio',
16 16
     'PugView'   =>  'System\\PugView',
17
-  ],
18
-  'middlewares' => [
17
+    ],
18
+    'middlewares' => [
19 19
     'admin' => [
20
-      'auth'        => 'App\\Middleware\\Admin\\AuthenticateMiddleware',
21
-      'ajax'        => 'App\\Middleware\\Admin\\AjaxMiddleware',
22
-      'permissions' => 'App\\Middleware\\Admin\\PermissionsMiddleware',
23
-      'redirect'    => 'App\\Middleware\\Admin\\RedirectMiddleware',
20
+        'auth'        => 'App\\Middleware\\Admin\\AuthenticateMiddleware',
21
+        'ajax'        => 'App\\Middleware\\Admin\\AjaxMiddleware',
22
+        'permissions' => 'App\\Middleware\\Admin\\PermissionsMiddleware',
23
+        'redirect'    => 'App\\Middleware\\Admin\\RedirectMiddleware',
24 24
     ],
25 25
     'website' => [
26 26
     ]
27
-  ]
27
+    ]
28 28
 ];
Please login to merge, or discard this patch.
App/Models/LoginModel.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@  discard block
 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
-  {
13
+    public function isValidLogin($email, $password)
14
+    {
15 15
     $user = $this->where('email=?' , $email)->fetch($this->table);
16 16
 
17 17
     if (! $user) return false;
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
     $this->user = $user;
20 20
 
21 21
     return password_verify($password, $user->password);
22
-  }
22
+    }
23 23
 
24
-  public function user()
25
-  {
24
+    public function user()
25
+    {
26 26
     return $this->user;
27
-  }
27
+    }
28 28
 
29
-  public function isLogged()
30
-  {
29
+    public function isLogged()
30
+    {
31 31
     if ($this->cookie->has('login')) {
32 32
 
33 33
     $code = $this->cookie->get('login');
@@ -48,5 +48,5 @@  discard block
 block discarded – undo
48 48
     $this->user = $user;
49 49
 
50 50
     return true;
51
-  }
51
+    }
52 52
 }
53 53
\ 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) return false;
17
+    if (!$user) return false;
18 18
 
19 19
     $this->user = $user;
20 20
 
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
     return false;
42 42
     }
43 43
 
44
-    $user = $this->where('code=?' , $code)->fetch($this->table);
44
+    $user = $this->where('code=?', $code)->fetch($this->table);
45 45
 
46
-    if (! $user) return false;
46
+    if (!$user) return false;
47 47
 
48 48
     $this->user = $user;
49 49
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
   {
15 15
     $user = $this->where('email=?' , $email)->fetch($this->table);
16 16
 
17
-    if (! $user) return false;
17
+    if (! $user) {
18
+        return false;
19
+    }
18 20
 
19 21
     $this->user = $user;
20 22
 
@@ -43,7 +45,9 @@  discard block
 block discarded – undo
43 45
 
44 46
     $user = $this->where('code=?' , $code)->fetch($this->table);
45 47
 
46
-    if (! $user) return false;
48
+    if (! $user) {
49
+        return false;
50
+    }
47 51
 
48 52
     $this->user = $user;
49 53
 
Please login to merge, or discard this patch.
App/Models/UsersGroupsModel.php 2 patches
Indentation   +9 added lines, -9 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
-  {
11
+    public function get($id)
12
+    {
13 13
     $userGroup = parent::get($id);
14 14
 
15 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 23
         $userGroup->pages[] = $userGroupInfo->page;
24
-      }
24
+        }
25 25
 
26
-      return $userGroup;
26
+        return $userGroup;
27
+    }
27 28
     }
28
-  }
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
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.
App/Models/UsersGroupPermissionsModel.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 
7 7
 class UsersGroupPermissionsModel extends Model
8 8
 {
9
-  protected $table = 'users_group_permissions';
9
+    protected $table = 'users_group_permissions';
10 10
 }
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
App/Models/SettingsModel.php 2 patches
Indentation   +12 added lines, -12 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
-  {
13
+    public function loadAll()
14
+    {
15 15
     foreach($this->all() as $setting) {
16 16
 
17
-      $this->settings[$setting->key] = $setting->value;
17
+        $this->settings[$setting->key] = $setting->value;
18
+    }
18 19
     }
19
-  }
20 20
 
21
-  public function get($key)
22
-  {
21
+    public function get($key)
22
+    {
23 23
     return array_get($this->settings, $key);
24
-  }
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.
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.
App/Models/UserModel.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
 
7 7
 class UserModel extends Model
8 8
 {
9
-  protected $table = 'users';
9
+    protected $table = 'users';
10 10
 
11
-  public function permissions($id)
12
-  {
11
+    public function permissions($id)
12
+    {
13 13
     return $this->hasMany('UsersGroupPermissions', $id, 'id', 'users_group_id');
14
-  }
14
+    }
15 15
 
16
-  public function comments($id)
17
-  {
16
+    public function comments($id)
17
+    {
18 18
     return $this->hasMany('Comment', $id);
19
-  }
19
+    }
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
routes/admin/index.php 2 patches
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.
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.