Completed
Branch master (faa857)
by refat
04:32
created
Core/System/Validation.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function require($input = null, $msg = null)
26 26
     {
27
-        if (! $this->input) $this->input = $input;
27
+        if (!$this->input) $this->input = $input;
28 28
         
29 29
         $value = $this->value($this->input);
30 30
       
31
-        if (! $value) {
31
+        if (!$value) {
32 32
 
33 33
             $msg = $msg ?: 'This input is required';
34 34
 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function email($input = null, $msg = null)
41 41
     {
42
-        if (! $this->input) $this->input = $input;
42
+        if (!$this->input) $this->input = $input;
43 43
 
44 44
         $value = $this->value($this->input);
45 45
 
46
-        if (! filter_var($value, FILTER_VALIDATE_EMAIL)) {
46
+        if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
47 47
 
48 48
             $msg = $msg ?: sprintf('%s is not valid Email', ucfirst($this->input));
49 49
 
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function number($input = null, $msg = null)
56 56
     {
57
-        if (! $this->input) $this->input = $input;
57
+        if (!$this->input) $this->input = $input;
58 58
 
59 59
         $value = $this->value($this->input);
60 60
 
61 61
         if ($value) { 
62 62
 
63
-            if (! is_numeric($value)) {
63
+            if (!is_numeric($value)) {
64 64
                 
65 65
                 $msg = $msg ?: 'the Input must be number';
66 66
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
     public function text($input = null, $msg = null)
74 74
     {
75
-        if (! $this->input) $this->input = $input;
75
+        if (!$this->input) $this->input = $input;
76 76
 
77 77
         $value = $this->value($this->input);
78 78
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
         $valueConfirm = $this->value($input);
128 128
 
129
-        if ($valuePassword && $valueConfirm ) {
129
+        if ($valuePassword && $valueConfirm) {
130 130
 
131 131
             if ($valuePassword !== $valueConfirm) {
132 132
     
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
     public function fails()
200 200
     {
201
-        return ! empty($this->errors);
201
+        return !empty($this->errors);
202 202
     }
203 203
 
204 204
     public function getMsgs()
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
     public function addError($input, $msg)
215 215
     {
216
-        if (! $this->checkError($input)) {
216
+        if (!$this->checkError($input)) {
217 217
 
218 218
             $this->errors[$input] = $msg;
219 219
         }
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function require($input = null, $msg = null)
26 26
     {
27
-        if (! $this->input) $this->input = $input;
27
+        if (! $this->input) {
28
+            $this->input = $input;
29
+        }
28 30
         
29 31
         $value = $this->value($this->input);
30 32
       
@@ -39,7 +41,9 @@  discard block
 block discarded – undo
39 41
 
40 42
     public function email($input = null, $msg = null)
41 43
     {
42
-        if (! $this->input) $this->input = $input;
44
+        if (! $this->input) {
45
+            $this->input = $input;
46
+        }
43 47
 
44 48
         $value = $this->value($this->input);
45 49
 
@@ -54,7 +58,9 @@  discard block
 block discarded – undo
54 58
 
55 59
     public function number($input = null, $msg = null)
56 60
     {
57
-        if (! $this->input) $this->input = $input;
61
+        if (! $this->input) {
62
+            $this->input = $input;
63
+        }
58 64
 
59 65
         $value = $this->value($this->input);
60 66
 
@@ -72,7 +78,9 @@  discard block
 block discarded – undo
72 78
 
73 79
     public function text($input = null, $msg = null)
74 80
     {
75
-        if (! $this->input) $this->input = $input;
81
+        if (! $this->input) {
82
+            $this->input = $input;
83
+        }
76 84
 
77 85
         $value = $this->value($this->input);
78 86
 
@@ -148,8 +156,12 @@  discard block
 block discarded – undo
148 156
         $id = null;
149 157
         $userId = null;
150 158
 
151
-        if (count($data) == 2) list($table, $column) = $data;
152
-        if (count($data) == 4) list($table, $column, $id, $userId) = $data;
159
+        if (count($data) == 2) {
160
+            list($table, $column) = $data;
161
+        }
162
+        if (count($data) == 4) {
163
+            list($table, $column, $id, $userId) = $data;
164
+        }
153 165
 
154 166
         $sql = $userId ? $column . ' = ? AND ' . $id . ' != ? ' : $column . ' = ?';
155 167
 
Please login to merge, or discard this patch.
Core/System/Url.php 1 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/System/Route.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     public function getProperRoute()
123 123
     {
124
-        foreach($this->routes as $route) {
124
+        foreach ($this->routes as $route) {
125 125
 
126 126
             if ($this->isMatching($route['pattern']) && $this->isMatchingRequestMethod($route['method'])) {
127 127
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
                     if (is_array($route['middleware'])) {
135 135
 
136
-                        foreach($route['middleware'] as $middleware) {
136
+                        foreach ($route['middleware'] as $middleware) {
137 137
 
138 138
                             $output = $this->middleware($middleware);
139 139
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
         $middlewareClass = $middlewares[$middleware];
227 227
 
228
-        if (! in_array($middlewareInterface, class_implements($middlewareClass))) {
228
+        if (!in_array($middlewareInterface, class_implements($middlewareClass))) {
229 229
             throw new Exception("$middlewareClass not Implement");
230 230
         }
231 231
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@  discard block
 block discarded – undo
39 39
             }
40 40
         }
41 41
 
42
-        if ($this->basController) $action = $this->basController . '/' . $action;
42
+        if ($this->basController) {
43
+            $action = $this->basController . '/' . $action;
44
+        }
43 45
 
44 46
         if ($this->groupMiddleware) {
45 47
 
@@ -75,7 +77,9 @@  discard block
 block discarded – undo
75 77
         $middlewareFrom = array_shift($groupOptions['middleware']);
76 78
         $middleware = $groupOptions['middleware'];
77 79
 
78
-        if ($this->app->request->url() !== $prefix) return $this;
80
+        if ($this->app->request->url() !== $prefix) {
81
+            return $this;
82
+        }
79 83
 
80 84
         $this->prefix = $prefix;
81 85
         $this->basController = $controller;
@@ -137,14 +141,18 @@  discard block
 block discarded – undo
137 141
 
138 142
                             $output = $this->middleware($middleware);
139 143
 
140
-                            if ($output != '') break;
144
+                            if ($output != '') {
145
+                                break;
146
+                            }
141 147
                         }
142 148
 
143 149
                     } else {
144 150
 
145 151
                         $output = $this->middleware($route['middleware']);
146 152
 
147
-                        if ($output != '') break;
153
+                        if ($output != '') {
154
+                            break;
155
+                        }
148 156
                     }
149 157
                 }
150 158
 
@@ -180,7 +188,9 @@  discard block
 block discarded – undo
180 188
     {
181 189
         $methods = ['GET', 'POST'];
182 190
 
183
-        if (($method == 'both') && in_array($this->app->request->method(), $methods)) return true;
191
+        if (($method == 'both') && in_array($this->app->request->method(), $methods)) {
192
+            return true;
193
+        }
184 194
 
185 195
         if (is_array($method)) {
186 196
 
@@ -190,7 +200,9 @@  discard block
 block discarded – undo
190 200
 
191 201
             } else if (count($method) == 2) {
192 202
 
193
-                if (in_array($method[0], $methods) && in_array($method[1], $methods)) return true;
203
+                if (in_array($method[0], $methods) && in_array($method[1], $methods)) {
204
+                    return true;
205
+                }
194 206
 
195 207
             } else {
196 208
 
@@ -233,7 +245,9 @@  discard block
 block discarded – undo
233 245
 
234 246
         $output = $middlewareObject->handle($this->app, static::NEXT);
235 247
 
236
-        if ($output && $output === static::NEXT) $output = '';
248
+        if ($output && $output === static::NEXT) {
249
+            $output = '';
250
+        }
237 251
 
238 252
         return $output;
239 253
     }
Please login to merge, or discard this patch.
Core/System/Paginatio.php 1 patch
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.
Core/helpers.php 1 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,14 +96,14 @@  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) . '...';
103 103
         }
104 104
     }
105 105
 }
106
-if (! function_exists('array_equal')) {
106
+if (!function_exists('array_equal')) {
107 107
     function array_equal($a, $b) {
108 108
         return (
109 109
             is_array($a) 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         );
114 114
     }
115 115
 }
116
-if (! function_exists('redirect_after')) {
116
+if (!function_exists('redirect_after')) {
117 117
     function redirect_after($num) {
118 118
         $app = Application::getInstance();
119 119
         $app->url->redirectTo('/', $num);
Please login to merge, or discard this patch.
routes/index.php 1 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.
App/Middleware/Admin/RedirectMiddleware.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@
 block discarded – undo
10 10
     public function handle()
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
 
17
-       } else {
17
+        } else {
18 18
 
19
-           $this->session->remove('error');
20
-       }
19
+            $this->session->remove('error');
20
+        }
21 21
     }
22 22
 }
23 23
\ 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
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     public function handle()
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.
App/Middleware/Admin/AuthenticateMiddleware.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 
27 27
         } else {
28 28
 
29
-            if (! in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/');
29
+            if (!in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/');
30 30
         }
31 31
 
32 32
         return $next;
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,11 +22,15 @@
 block discarded – undo
22 22
 
23 23
         if ($login->isLogged()) {
24 24
             
25
-            if (in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/');
25
+            if (in_array($request, $pagesWhenLogout)) {
26
+                $app->url->redirectTo('/');
27
+            }
26 28
 
27 29
         } else {
28 30
 
29
-            if (! in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/');
31
+            if (! in_array($request, $pagesWhenLogout)) {
32
+                $app->url->redirectTo('/');
33
+            }
30 34
         }
31 35
 
32 36
         return $next;
Please login to merge, or discard this patch.
App/Models/LoginModel.php 2 patches
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.