Completed
Push — master ( 62528b...e30bf0 )
by refat
03:18
created
Core/System/Application.php 3 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 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
-  {
18
+    public function __construct(File $file)
19
+    {
20 20
     $this->handleErrors();
21 21
 
22 22
     $this->share('file', $file);
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
     $this->share('alias', $this->file->call($this->file->to('config/alias', '.php')));
27 27
 
28 28
     $this->loadHelpers();
29
-  }
29
+    }
30 30
 
31
-  private function handleErrors() {
31
+    private function handleErrors() {
32 32
 
33 33
     $run = new Whoops();
34 34
 
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
     }
45 45
 
46 46
     $run->register();
47
-  }
47
+    }
48 48
 
49
-  public static function getInstance($file = null)
50
-  {
49
+    public static function getInstance($file = null)
50
+    {
51 51
     return static::$instance = is_null(static::$instance) ? new static($file) : static::$instance;
52
-  }
52
+    }
53 53
 
54
-  public function run()
55
-  {
54
+    public function run()
55
+    {
56 56
     $this->session->start();
57 57
 
58 58
     $this->request->prepareUrl();
@@ -66,32 +66,32 @@  discard block
 block discarded – undo
66 66
     $this->response->setOutput($output);
67 67
 
68 68
     $this->response->send();
69
-  }
69
+    }
70 70
 
71
-  private function loadHelpers()
72
-  {
71
+    private function loadHelpers()
72
+    {
73 73
     $helpers = $this->file->to('Core/helpers', '.php');
74 74
 
75 75
     $this->file->call($helpers);
76
-  }
76
+    }
77 77
 
78
-  public function coreClasses()
79
-  {
78
+    public function coreClasses()
79
+    {
80 80
     return $this->alias['classes'];
81
-  }
81
+    }
82 82
 
83
-  public function share($key, $value)
84
-  {
83
+    public function share($key, $value)
84
+    {
85 85
     if ($value instanceof Closure) {
86 86
 
87 87
         $value = call_user_func($value, $this);
88 88
     }
89 89
 
90 90
     $this->container[$key] = $value;
91
-  }
91
+    }
92 92
 
93
-  public function get($key)
94
-  {
93
+    public function get($key)
94
+    {
95 95
     if (! $this->isSharing($key)) {
96 96
         if ($this->isCoreAlias($key)) {
97 97
 
@@ -103,27 +103,27 @@  discard block
 block discarded – undo
103 103
         }
104 104
     }
105 105
     return $this->container[$key];
106
-  }
106
+    }
107 107
 
108
-  public function isSharing($key)
109
-  {
108
+    public function isSharing($key)
109
+    {
110 110
     return isset($this->container[$key]);
111
-  }
111
+    }
112 112
 
113
-  public function isCoreAlias($key)
114
-  {
113
+    public function isCoreAlias($key)
114
+    {
115 115
     return isset($this->coreClasses()[$key]);
116
-  }
116
+    }
117 117
 
118
-  public function createObject($key)
119
-  {
118
+    public function createObject($key)
119
+    {
120 120
     $object = $this->coreClasses()[$key];
121 121
 
122 122
     return new $object($this);
123
-  }
123
+    }
124 124
 
125
-  public function __get($key)
126
-  {
125
+    public function __get($key)
126
+    {
127 127
     return $this->get($key);
128
-  }
128
+    }
129 129
 }
130 130
\ 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
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
 
93 93
   public function get($key)
94 94
   {
95
-    if (! $this->isSharing($key)) {
95
+    if (!$this->isSharing($key)) {
96 96
         if ($this->isCoreAlias($key)) {
97 97
 
98 98
             $this->share($key, $this->createObject($key));
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,9 @@
 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
 
Please login to merge, or discard this patch.
Core/System/Route.php 3 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -6,53 +6,53 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Route
8 8
 {
9
-  const NEXT = '_NEXT_';
9
+    const NEXT = '_NEXT_';
10 10
 
11
-  private $app;
11
+    private $app;
12 12
 
13
-  private $routes = [];
13
+    private $routes = [];
14 14
 
15
-  public $current = [];
15
+    public $current = [];
16 16
 
17
-  private $prefix;
17
+    private $prefix;
18 18
 
19
-  private $basController;
19
+    private $basController;
20 20
 
21
-  private $middlewareFrom;
21
+    private $middlewareFrom;
22 22
 
23
-  private $groupMiddleware = [];
23
+    private $groupMiddleware = [];
24 24
 
25
-  public function __construct(Application $app)
26
-  {
25
+    public function __construct(Application $app)
26
+    {
27 27
     $this->app = $app;
28
-  }
28
+    }
29 29
 
30
-  public function add($url, $action, $requestMethos = 'GET', $middleware = [])
31
-  {
30
+    public function add($url, $action, $requestMethos = 'GET', $middleware = [])
31
+    {
32 32
     if ($this->prefix) {
33 33
 
34
-      if ($this->prefix !== '/') {
34
+        if ($this->prefix !== '/') {
35 35
 
36 36
         $url = $this->prefix . $url;
37 37
 
38 38
         $url = rtrim($url, '/');
39
-      }
39
+        }
40 40
     }
41 41
 
42
-      if ($this->basController) $action = $this->basController . '/' . $action;
42
+        if ($this->basController) $action = $this->basController . '/' . $action;
43 43
 
44 44
     if ($this->groupMiddleware) {
45 45
 
46
-      if (is_array($middleware)) {
46
+        if (is_array($middleware)) {
47 47
 
48 48
         $middleware = array_merge($this->groupMiddleware[0], $middleware);
49 49
 
50
-      } else {
50
+        } else {
51 51
 
52 52
         array_push($this->groupMiddleware[0], $middleware);
53 53
 
54 54
         $middleware = $this->groupMiddleware[0];
55
-      }
55
+        }
56 56
     }
57 57
 
58 58
     $routes = [
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
     $this->routes[] = $routes;
67 67
 
68 68
     return $this;
69
-  }
69
+    }
70 70
 
71
-  public function group($groupOptions, callable $callback)
72
-  {
71
+    public function group($groupOptions, callable $callback)
72
+    {
73 73
     $prefix = $groupOptions['prefix'];
74 74
     $controller = $groupOptions['controller'];
75 75
     $middlewareFrom = array_shift($groupOptions['middleware']);
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
     $callback($this);
86 86
 
87 87
     return $this;
88
-  }
88
+    }
89 89
 
90
-  public function package($url, $controller)
91
-  {
90
+    public function package($url, $controller)
91
+    {
92 92
     $this->add("$url", "$controller");
93 93
     $this->add("$url/add", "$controller@add", "POST");
94 94
     $this->add("$url/submit", "$controller@submit", "POST");
@@ -97,19 +97,19 @@  discard block
 block discarded – undo
97 97
     $this->add("$url/delete/:id", "$controller@delete", "POST");
98 98
 
99 99
     return $this;
100
-  }
100
+    }
101 101
 
102
-  public function generatePattern($url)
103
-  {
102
+    public function generatePattern($url)
103
+    {
104 104
     $pattern = '#^';
105 105
     $pattern .= str_replace([':text', ':id'], ['([a-zA-Z0-9-]+)', '(\d+)'], $url);
106 106
     $pattern .= '$#';
107 107
 
108 108
     return $pattern;
109
-  }
109
+    }
110 110
 
111
-  public function getAction($action)
112
-  {
111
+    public function getAction($action)
112
+    {
113 113
     $action = str_replace('/', '\\', $action);
114 114
 
115 115
     $action = (strpos($action, '@') != 0) ? $action : $action . '@index';
@@ -117,49 +117,49 @@  discard block
 block discarded – undo
117 117
     $action = explode('@', $action);
118 118
 
119 119
     return $action;
120
-  }
120
+    }
121 121
 
122
-  public function getProperRoute()
123
-  {
122
+    public function getProperRoute()
123
+    {
124 124
     foreach($this->routes as $route) {
125 125
 
126 126
         if ($this->isMatching($route['pattern']) && $this->isMatchingRequestMethod($route['method'])) {
127 127
 
128
-          $this->current = $route;
128
+            $this->current = $route;
129 129
 
130
-          $output = '';
130
+            $output = '';
131 131
 
132
-          if ($route['middleware']) {
132
+            if ($route['middleware']) {
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
 
140 140
                 if ($output != '') break;
141
-              }
141
+                }
142 142
 
143 143
             } else {
144 144
 
145
-              $output = $this->middleware($route['middleware']);
145
+                $output = $this->middleware($route['middleware']);
146 146
 
147
-              if ($output != '') break;
147
+                if ($output != '') break;
148
+            }
148 149
             }
149
-          }
150 150
 
151 151
             if ($output == '') {
152 152
 
153
-              list($controller, $method) = $route['action'];
153
+                list($controller, $method) = $route['action'];
154 154
 
155
-              $arguments = $this->getArgumentsFor($route['pattern']);
155
+                $arguments = $this->getArgumentsFor($route['pattern']);
156 156
 
157
-              $output = (string) $this->app->load->action($controller, $method, $arguments);
157
+                $output = (string) $this->app->load->action($controller, $method, $arguments);
158 158
 
159
-              return $output;
159
+                return $output;
160 160
 
161 161
             } else {
162
-              break;
162
+                break;
163 163
             }
164 164
         }
165 165
     }
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
     $output = (string) $this->app->load->action('notFound', 'index', []);
168 168
 
169 169
     return $output;
170
-  }
170
+    }
171 171
 
172
-  public function isMatching($pattern)
173
-  {
172
+    public function isMatching($pattern)
173
+    {
174 174
     $url = $this->app->request->url();
175 175
 
176 176
     return preg_match($pattern, $url);
177
-  }
177
+    }
178 178
 
179
-  private function isMatchingRequestMethod($method)
180
-  {
179
+    private function isMatchingRequestMethod($method)
180
+    {
181 181
     $methods = ['GET', 'POST'];
182 182
 
183 183
     if (($method == 'both') && in_array($this->app->request->method(), $methods)) return true;
@@ -186,23 +186,23 @@  discard block
 block discarded – undo
186 186
 
187 187
         if (count($method) == 1) {
188 188
 
189
-          $method = $method[0];
189
+            $method = $method[0];
190 190
 
191 191
         } else if (count($method) == 2) {
192 192
 
193
-          if (in_array($method[0], $methods) && in_array($method[1], $methods)) return true;
193
+            if (in_array($method[0], $methods) && in_array($method[1], $methods)) return true;
194 194
 
195 195
         } else {
196 196
 
197
-          return false;
197
+            return false;
198 198
         }
199 199
     }
200 200
 
201 201
     return $this->app->request->method() == $method;
202
-  }
202
+    }
203 203
 
204
-  public function getArgumentsFor($pattern)
205
-  {
204
+    public function getArgumentsFor($pattern)
205
+    {
206 206
     $url = $this->app->request->url();
207 207
 
208 208
     preg_match($pattern, $url, $matches);
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
     array_shift($matches);
211 211
 
212 212
     return $matches;
213
-  }
213
+    }
214 214
 
215
-  public function getCurrent($key)
216
-  {
215
+    public function getCurrent($key)
216
+    {
217 217
     return $this->current[$key];
218
-  }
218
+    }
219 219
 
220
-  private function middleware($middleware, $from = 'admin')
221
-  {
220
+    private function middleware($middleware, $from = 'admin')
221
+    {
222 222
     $middlewareInterface = 'App\\Middleware\\MiddlewaresInterface';
223 223
 
224 224
     $middlewares = $this->app->alias['middlewares'][$from];
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     $middlewareClass = $middlewares[$middleware];
227 227
 
228 228
     if (! in_array($middlewareInterface, class_implements($middlewareClass))) {
229
-      throw new Exception("$middlewareClass not Implement");
229
+        throw new Exception("$middlewareClass not Implement");
230 230
     }
231 231
 
232 232
     $middlewareObject = new $middlewareClass;
@@ -236,5 +236,5 @@  discard block
 block discarded – undo
236 236
     if ($output && $output === static::NEXT) $output = '';
237 237
 
238 238
     return $output;
239
-  }
239
+    }
240 240
 }
241 241
\ No newline at end of file
Please login to merge, or discard this patch.
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/PugView.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@  discard block
 block discarded – undo
6 6
 
7 7
 class PugView
8 8
 {
9
-  private $app;
9
+    private $app;
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 render($path, array $context)
17
-  {
16
+    public function render($path, array $context)
17
+    {
18 18
 
19 19
     $this->app->file->css();
20 20
     $pug = new Pug(array(
@@ -49,5 +49,5 @@  discard block
 block discarded – undo
49 49
     ];
50 50
 
51 51
     return $pug->render($file, $context);
52
-  }
52
+    }
53 53
 }
54 54
\ 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
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
     //File Path
31 31
     $file = str_replace('/', DS, $path);
32
-    $file = $dir . DS . 'template' . DS  . $file . '.pug';
32
+    $file = $dir . DS . 'template' . DS . $file . '.pug';
33 33
 
34 34
     //Css Path
35 35
     $css = $this->app->file->css();
Please login to merge, or discard this patch.
Core/System/Paginatio.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -4,25 +4,25 @@  discard block
 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
-  {
17
+    public function __construct(Application $app)
18
+    {
19 19
     $this->app = $app;
20 20
 
21 21
     $this->setCurrentPage();
22
-  }
22
+    }
23 23
 
24
-  private function setCurrentPage()
25
-  {
24
+    private function setCurrentPage()
25
+    {
26 26
     $page = $this->app->request->get('page');
27 27
 
28 28
     if (! is_numeric($page) || $page < 1) {
@@ -30,61 +30,61 @@  discard block
 block discarded – undo
30 30
     }
31 31
 
32 32
     $this->page = $page;
33
-  }
33
+    }
34 34
 
35
-  public function page()
36
-  {
35
+    public function page()
36
+    {
37 37
     return $this->page;
38
-  }
38
+    }
39 39
 
40
-  public function itemsPerPage()
41
-  {
40
+    public function itemsPerPage()
41
+    {
42 42
     return $this->itemsPerPage;
43
-  }
43
+    }
44 44
 
45
-  public function totalItems()
46
-  {
45
+    public function totalItems()
46
+    {
47 47
     return $this->totalItems;
48
-  }
48
+    }
49 49
 
50
-  public function last()
51
-  {
50
+    public function last()
51
+    {
52 52
     return $this->lastPage;
53
-  }
53
+    }
54 54
 
55
-  public function next()
56
-  {
55
+    public function next()
56
+    {
57 57
     return $this->page + 1;
58
-  }
58
+    }
59 59
 
60
-  public function prev()
61
-  {
60
+    public function prev()
61
+    {
62 62
     return $this->page - 1;
63
-  }
63
+    }
64 64
 
65
-  public function setTotalItems($totalItems)
66
-  {
65
+    public function setTotalItems($totalItems)
66
+    {
67 67
     $this->totalItems = $totalItems;
68 68
 
69 69
     return $this;
70
-  }
70
+    }
71 71
 
72
-  public function setItemsPerPage($itemsPerPage)
73
-  {
72
+    public function setItemsPerPage($itemsPerPage)
73
+    {
74 74
     $this->itemsPerPage = $itemsPerPage;
75 75
 
76 76
     return $this;
77
-  }
77
+    }
78 78
 
79
-  public function paginate()
80
-  {
79
+    public function paginate()
80
+    {
81 81
     $this->setLastPage();
82 82
 
83 83
     return $this;
84
-  }
84
+    }
85 85
 
86
-  private function setLastPage()
87
-  {
86
+    private function setLastPage()
87
+    {
88 88
     $this->lastPage = ceil($this->totalItems / $this->itemsPerPage);
89
-  }
89
+    }
90 90
 }
91 91
\ 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
@@ -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/System/Controller.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@
 block discarded – undo
4 4
 
5 5
 abstract class Controller
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 __get($key)
15
-  {
16
-      return $this->app->get($key);
17
-  }
14
+    public function __get($key)
15
+    {
16
+        return $this->app->get($key);
17
+    }
18 18
 }
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
Core/System/Http/Request.php 3 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -6,23 +6,23 @@  discard block
 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
-  {
24
+    public function prepareUrl()
25
+    {
26 26
     $script = dirname($this->server('SCRIPT_NAME'));
27 27
 
28 28
     $requestUri = $this->server('REQUEST_URI');
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 
32 32
     if (! in_array($script, ['/', '\\'])) {
33 33
 
34
-      $this->url = preg_replace('#^' . $script . '#', '', $requestUri);
34
+        $this->url = preg_replace('#^' . $script . '#', '', $requestUri);
35 35
     } else {
36 36
 
37
-      $this->url = $requestUri;
37
+        $this->url = $requestUri;
38 38
     }
39 39
 
40 40
     if ($this->url !== '/') $this->url = rtrim($this->url, '/');
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 
44 44
     if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
45 45
 
46
-      $isSecure = true;
46
+        $isSecure = true;
47 47
 
48 48
     }
49 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;
50
+        $isSecure = true;
51 51
     }
52 52
 
53 53
     $REQUEST_PROTOCOL = $isSecure ? 'https' : 'http';
@@ -55,51 +55,51 @@  discard block
 block discarded – undo
55 55
     $this->link = $REQUEST_PROTOCOL . '://' . $this->server('HTTP_HOST');
56 56
 
57 57
     $this->baseUrl = $this->link . $requestUri;
58
-  }
58
+    }
59 59
 
60
-  public function get($key)
61
-  {
60
+    public function get($key)
61
+    {
62 62
     $value = array_get($_GET, $key, $default);
63 63
 
64 64
     if (is_array($value)) {
65
-      $value = array_filter($value);
65
+        $value = array_filter($value);
66 66
     } else {
67
-      $value = trim($value);
67
+        $value = trim($value);
68 68
     }
69 69
 
70 70
     return $value;
71
-  }
71
+    }
72 72
 
73
-  public function post($key)
74
-  {
73
+    public function post($key)
74
+    {
75 75
     $value = array_get($_POST, $key, $default);
76 76
 
77 77
     if (is_array($value)) {
78
-      $value = array_filter($value);
78
+        $value = array_filter($value);
79 79
     } else {
80
-      $value = trim($value);
80
+        $value = trim($value);
81 81
     }
82 82
 
83 83
     return $value;
84
-  }
84
+    }
85 85
 
86
-  public function setPost($key, $value)
87
-  {
86
+    public function setPost($key, $value)
87
+    {
88 88
     $_POST[$key] = $value;
89
-  }
89
+    }
90 90
 
91
-  public function posts()
92
-  {
91
+    public function posts()
92
+    {
93 93
     return $_POST;
94
-  }
94
+    }
95 95
 
96
-  public function files()
97
-  {
96
+    public function files()
97
+    {
98 98
     return $_FILES;
99
-  }
99
+    }
100 100
 
101
-  public function file($input)
102
-  {
101
+    public function file($input)
102
+    {
103 103
     if (isset($this->files[$input])) return $this->files[$input];
104 104
 
105 105
     $upoadedFile = new UploadeFile($this->app, $input);
@@ -107,35 +107,35 @@  discard block
 block discarded – undo
107 107
     $this->files[$input] = $upoadedFile;
108 108
 
109 109
     return $this->files[$input];
110
-  }
110
+    }
111 111
 
112
-  public function server($key)
113
-  {
112
+    public function server($key)
113
+    {
114 114
     return array_get($_SERVER, $key);
115
-  }
115
+    }
116 116
 
117
-  public function method()
118
-  {
117
+    public function method()
118
+    {
119 119
     return $this->server('REQUEST_METHOD');
120
-  }
120
+    }
121 121
 
122
-  public function referer()
123
-  {
122
+    public function referer()
123
+    {
124 124
     return $this->server('HTTP_REFERER');
125
-  }
125
+    }
126 126
 
127
-  public function baseUrl()
128
-  {
127
+    public function baseUrl()
128
+    {
129 129
     return $this->baseUrl;
130
-  }
130
+    }
131 131
 
132
-  public function url()
133
-  {
132
+    public function url()
133
+    {
134 134
     return $this->url;
135
-  }
135
+    }
136 136
 
137
-  public function link()
138
-  {
137
+    public function link()
138
+    {
139 139
     return $this->link;
140
-  }
140
+    }
141 141
 }
142 142
\ 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
@@ -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.
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/Http/Response.php 2 patches
Indentation   +24 added lines, -24 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;
9
+    private $app;
10 10
 
11
-  private $headers = [];
11
+    private $headers = [];
12 12
 
13
-  private $content = '';
13
+    private $content = '';
14 14
 
15
-  public function __construct(Application $app)
16
-  {
15
+    public function __construct(Application $app)
16
+    {
17 17
     $this->app = $app;
18
-  }
18
+    }
19 19
 
20
-  public function setOutput($content)
21
-  {
20
+    public function setOutput($content)
21
+    {
22 22
     $this->content = $content;
23
-  }
23
+    }
24 24
 
25
-  public function setHeaders($header, $value)
26
-  {
25
+    public function setHeaders($header, $value)
26
+    {
27 27
     $this->headers[$header] = $value;
28
-  }
28
+    }
29 29
 
30
-  public function sendOutput()
31
-  {
30
+    public function sendOutput()
31
+    {
32 32
     echo $this->content;
33
-  }
33
+    }
34 34
 
35
-  public function sendHeaders()
36
-  {
37
-      foreach($this->headers as $header => $value)
38
-      {
35
+    public function sendHeaders()
36
+    {
37
+        foreach($this->headers as $header => $value)
38
+        {
39 39
         header($header . ':' . $value);
40
-      }
41
-  }
40
+        }
41
+    }
42 42
 
43
-  public function send()
44
-  {
43
+    public function send()
44
+    {
45 45
     $this->sendHeaders();
46 46
 
47 47
     $this->sendOutput();
48
-  }
48
+    }
49 49
 }
50 50
\ 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
@@ -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.
Core/System/Http/UploadeFile.php 3 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -6,35 +6,35 @@  discard block
 block discarded – undo
6 6
 
7 7
 class UploadeFile
8 8
 {
9
-  private $app;
9
+    private $app;
10 10
 
11
-  private $file = [];
11
+    private $file = [];
12 12
 
13
-  private $fileName;
13
+    private $fileName;
14 14
 
15
-  private $nameOnly;
15
+    private $nameOnly;
16 16
 
17
-  private $extension;
17
+    private $extension;
18 18
 
19
-  private $minetype;
19
+    private $minetype;
20 20
 
21
-  private $tempFile;
21
+    private $tempFile;
22 22
 
23
-  private $size;
23
+    private $size;
24 24
 
25
-  private $error;
25
+    private $error;
26 26
 
27
-  private const AllOW_EXTENSION = ['png', 'jpg', 'jpeg', 'gif', 'webp'];
27
+    private const AllOW_EXTENSION = ['png', 'jpg', 'jpeg', 'gif', 'webp'];
28 28
 
29
-  public function __construct(Application $app, $input)
30
-  {
29
+    public function __construct(Application $app, $input)
30
+    {
31 31
     $this->app = $app;
32 32
 
33 33
     $this->getFileInfo($input);
34
-  }
34
+    }
35 35
 
36
-  private function getFileInfo($input)
37
-  {
36
+    private function getFileInfo($input)
37
+    {
38 38
     if (empty($_FILES[$input])) return;
39 39
 
40 40
     $file = $_FILES[$input];
@@ -58,50 +58,50 @@  discard block
 block discarded – undo
58 58
     $this->nameOnly = $fileInfo['filename'];
59 59
 
60 60
     $this->extension = $fileInfo['extension'];
61
-  }
61
+    }
62 62
 
63
-  public function exists()
64
-  {
63
+    public function exists()
64
+    {
65 65
     return ! empty($this->file);
66
-  }
66
+    }
67 67
 
68
-  public function getFileName()
69
-  {
68
+    public function getFileName()
69
+    {
70 70
     return $this->fileName;
71
-  }
71
+    }
72 72
 
73
-  public function getNameOnly()
74
-  {
73
+    public function getNameOnly()
74
+    {
75 75
     return $this->nameOnly;
76
-  }
76
+    }
77 77
 
78
-  public function getExtension()
79
-  {
78
+    public function getExtension()
79
+    {
80 80
     return $this->extension;
81
-  }
81
+    }
82 82
 
83
-  public function getMinetype()
84
-  {
83
+    public function getMinetype()
84
+    {
85 85
     return $this->minetype;
86
-  }
86
+    }
87 87
 
88
-  public function getSize()
89
-  {
88
+    public function getSize()
89
+    {
90 90
     return $this->size;
91
-  }
91
+    }
92 92
 
93
-  public function getTempFile()
94
-  {
93
+    public function getTempFile()
94
+    {
95 95
     return $this->tempFile;
96
-  }
96
+    }
97 97
 
98
-  public function isImage()
99
-  {
98
+    public function isImage()
99
+    {
100 100
     return strpos($this->minetype, 'image/') === 0 && in_array($this->extension, self::AllOW_EXTENSION);
101
-  }
101
+    }
102 102
 
103
-  public function moveTo($target, $newName = null)
104
-  {
103
+    public function moveTo($target, $newName = null)
104
+    {
105 105
     $newName = $newName ?: sha1(rand()) . sha1(rand());
106 106
 
107 107
     $newName .= '.' . $this->extension;
@@ -116,5 +116,5 @@  discard block
 block discarded – undo
116 116
     $uploade = move_uploaded_file($this->tempFile, $filePath);
117 117
 
118 118
     return $uploade;
119
-  }
119
+    }
120 120
 }
121 121
\ 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
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
   public function exists()
64 64
   {
65
-    return ! empty($this->file);
65
+    return !empty($this->file);
66 66
   }
67 67
 
68 68
   public function getFileName()
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
     $newName .= '.' . $this->extension;
108 108
 
109
-    if (! is_dir($target)) mkdir($target, 0777, true);
109
+    if (!is_dir($target)) mkdir($target, 0777, true);
110 110
 
111 111
     $filePath = $target . $newName;
112 112
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,13 +35,17 @@  discard block
 block discarded – undo
35 35
 
36 36
   private function getFileInfo($input)
37 37
   {
38
-    if (empty($_FILES[$input])) return;
38
+    if (empty($_FILES[$input])) {
39
+        return;
40
+    }
39 41
 
40 42
     $file = $_FILES[$input];
41 43
 
42 44
     $this->error = $file['error'];
43 45
 
44
-    if ($this->error != UPLOAD_ERR_OK) return;
46
+    if ($this->error != UPLOAD_ERR_OK) {
47
+        return;
48
+    }
45 49
 
46 50
     $this->file = $file;
47 51
 
@@ -106,7 +110,9 @@  discard block
 block discarded – undo
106 110
 
107 111
     $newName .= '.' . $this->extension;
108 112
 
109
-    if (! is_dir($target)) mkdir($target, 0777, true);
113
+    if (! is_dir($target)) {
114
+        mkdir($target, 0777, true);
115
+    }
110 116
 
111 117
     $filePath = $target . $newName;
112 118
 
Please login to merge, or discard this patch.
Core/System/Validation.php 3 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -4,26 +4,26 @@  discard block
 block discarded – undo
4 4
 
5 5
 class Validation
6 6
 {
7
-  private $app;
7
+    private $app;
8 8
 
9
-  private $input;
9
+    private $input;
10 10
 
11
-  private $errors = [];
11
+    private $errors = [];
12 12
 
13
-  public function __construct(Application $app)
14
-  {
13
+    public function __construct(Application $app)
14
+    {
15 15
     $this->app = $app;
16
-  }
16
+    }
17 17
 
18
-  public function input($input)
19
-  {
18
+    public function input($input)
19
+    {
20 20
     $this->input = $input;
21 21
 
22 22
     return $this;
23
-  }
23
+    }
24 24
 
25
-  public function require($input = null, $msg = null)
26
-  {
25
+    public function require($input = null, $msg = null)
26
+    {
27 27
     if (! $this->input) $this->input = $input;
28 28
 
29 29
     $value = $this->value($this->input);
@@ -35,111 +35,111 @@  discard block
 block discarded – undo
35 35
         $this->addError($this->input, $msg);
36 36
     }
37 37
     return $this;
38
-  }
38
+    }
39 39
 
40
-  public function email($input = null, $msg = null)
41
-  {
40
+    public function email($input = null, $msg = null)
41
+    {
42 42
     if (! $this->input) $this->input = $input;
43 43
 
44 44
     $value = $this->value($this->input);
45 45
 
46 46
     if (! filter_var($value, FILTER_VALIDATE_EMAIL)) {
47 47
 
48
-      $msg = $msg ?: sprintf('%s is not valid Email', ucfirst($this->input));
48
+        $msg = $msg ?: sprintf('%s is not valid Email', ucfirst($this->input));
49 49
 
50
-      $this->addError($this->input, $msg);
50
+        $this->addError($this->input, $msg);
51 51
     }
52 52
     return $this;
53
-  }
53
+    }
54 54
 
55
-  public function number($input = null, $msg = null)
56
-  {
55
+    public function number($input = null, $msg = null)
56
+    {
57 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
 
67 67
         $this->addError($this->input, $msg);
68
-      }
68
+        }
69 69
     }
70 70
     return $this;
71
-  }
71
+    }
72 72
 
73
-  public function text($input = null, $msg = null)
74
-  {
73
+    public function text($input = null, $msg = null)
74
+    {
75 75
     if (! $this->input) $this->input = $input;
76 76
 
77 77
     $value = $this->value($this->input);
78 78
 
79 79
     if ($value) {
80 80
 
81
-      if (is_numeric($value)) {
81
+        if (is_numeric($value)) {
82 82
 
83 83
         $msg = $msg ?: 'the Input must be Text';
84 84
 
85 85
         $this->addError($this->input, $msg);
86
-      }
86
+        }
87 87
     }
88 88
     return $this;
89
-  }
89
+    }
90 90
 
91
-  public function minLen($length, $msg = null)
92
-  {
91
+    public function minLen($length, $msg = null)
92
+    {
93 93
     $value = $this->value($this->input);
94 94
 
95 95
     if ($value) {
96 96
 
97
-      if (strlen($value) < $length) {
97
+        if (strlen($value) < $length) {
98 98
 
99 99
         $msg = $msg ?: 'This input must be at least ' . $length;
100 100
 
101 101
         $this->addError($this->input, $msg);
102
-      }
102
+        }
103 103
     }
104 104
     return $this;
105
-  }
105
+    }
106 106
 
107
-  public function maxLen($length, $msg = null)
108
-  {
107
+    public function maxLen($length, $msg = null)
108
+    {
109 109
     $value = $this->value($this->input);
110 110
 
111 111
     if ($value) {
112 112
 
113
-      if (strlen($value) > $length) {
113
+        if (strlen($value) > $length) {
114 114
 
115 115
         $msg = $msg ?: 'This must be ' . $length . ' or fewer';
116 116
 
117 117
         $this->addError($this->input, $msg);
118
-      }
118
+        }
119 119
     }
120 120
     return $this;
121
-  }
121
+    }
122 122
 
123
-  public function match($input, $msg = null)
124
-  {
123
+    public function match($input, $msg = null)
124
+    {
125 125
     $valuePassword = $this->value($this->input);
126 126
 
127 127
     $valueConfirm = $this->value($input);
128 128
 
129 129
     if ($valuePassword && $valueConfirm ) {
130 130
 
131
-      if ($valuePassword !== $valueConfirm) {
131
+        if ($valuePassword !== $valueConfirm) {
132 132
 
133 133
         $msg = $msg ?: 'Passwords does not match';
134 134
 
135 135
         $this->addError('match', $msg);
136
-      }
136
+        }
137 137
     }
138 138
     return $this;
139
-  }
139
+    }
140 140
 
141
-  public function unique($data, $msg = null)
142
-  {
141
+    public function unique($data, $msg = null)
142
+    {
143 143
     $value = $this->value($this->input);
144 144
 
145 145
     $table = null;
@@ -162,65 +162,65 @@  discard block
 block discarded – undo
162 162
 
163 163
     if ($result) {
164 164
 
165
-      $msg = $msg ?: sprintf('%s is already exist', ucfirst($this->input));
165
+        $msg = $msg ?: sprintf('%s is already exist', ucfirst($this->input));
166 166
 
167
-      $this->addError($this->input, $msg);
167
+        $this->addError($this->input, $msg);
168 168
     }
169 169
     return $this;
170
-  }
170
+    }
171 171
 
172
-  public function requireFile($input, $msg = null)
173
-  {
172
+    public function requireFile($input, $msg = null)
173
+    {
174 174
 
175
-  }
175
+    }
176 176
 
177
-  public function image($input, $msg = null)
178
-  {
177
+    public function image($input, $msg = null)
178
+    {
179 179
 
180
-  }
180
+    }
181 181
 
182
-  public function message($msg = null)
183
-  {
182
+    public function message($msg = null)
183
+    {
184 184
     $this->errors[] = $msg;
185 185
 
186 186
     return $this;
187
-  }
187
+    }
188 188
 
189
-  public function validate()
190
-  {
189
+    public function validate()
190
+    {
191 191
 
192
-  }
192
+    }
193 193
 
194
-  public function passes()
195
-  {
194
+    public function passes()
195
+    {
196 196
     return empty($this->errors);
197
-  }
197
+    }
198 198
 
199
-  public function fails()
200
-  {
199
+    public function fails()
200
+    {
201 201
     return ! empty($this->errors);
202
-  }
202
+    }
203 203
 
204
-  public function getMsgs()
205
-  {
204
+    public function getMsgs()
205
+    {
206 206
     return $this->errors;
207
-  }
207
+    }
208 208
 
209
-  private function value($input)
210
-  {
209
+    private function value($input)
210
+    {
211 211
     return $this->app->request->post($input);
212
-  }
212
+    }
213 213
 
214
-  public function addError($input, $msg)
215
-  {
214
+    public function addError($input, $msg)
215
+    {
216 216
     if (! $this->checkError($input)) {
217 217
 
218
-      $this->errors[$input] = $msg;
218
+        $this->errors[$input] = $msg;
219
+    }
219 220
     }
220
-  }
221 221
 
222
-  private function checkError($input)
223
-  {
222
+    private function checkError($input)
223
+    {
224 224
     return array_key_exists($input, $this->errors);
225
-  }
225
+    }
226 226
 }
227 227
\ No newline at end of file
Please login to merge, or discard this patch.
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.