Completed
Push — master ( a057a5...0d5a11 )
by Afshin
02:17
created
core/Services/AuthService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
         return isset($_SESSION['user']);
25 25
     }
26 26
 
27
-    public function attempt(string $username,string $password)
27
+    public function attempt(string $username, string $password)
28 28
     {
29 29
         $user = UserDataAccess::getUserLoginField($username)->first();
30 30
 
31 31
         if (!$user) {
32 32
             return false;
33 33
         }
34
-        if (password_verify($password,$user->password)) {
34
+        if (password_verify($password, $user->password)) {
35 35
             $_SESSION['user'] = $user->id;
36 36
             return true;
37 37
         }
Please login to merge, or discard this patch.
core/Helpers/Url.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
     }
21 21
 
22
-    public static function getPrevious(){
22
+    public static function getPrevious() {
23 23
         return $_SERVER['HTTP_REFERER'];
24 24
     }
25 25
     public static function getRoot($exclude_path = '')
Please login to merge, or discard this patch.
core/Route.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@  discard block
 block discarded – undo
34 34
 
35 35
     public  function resource($url, $controller, $args = [])
36 36
     {
37
-        $url = rtrim($url,'/');
38
-        $routeNames = implode('.',explode('/',trim($url,'/')));
39
-
40
-        $this->app->group($url, function () use ($controller,$routeNames, $args) {
41
-            $this->get('', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames.'.index');
42
-            $this->get('/', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames.'.index');
43
-            $this->get('/index', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames.'.index');
44
-
45
-            $this->get('/create', $controller . ':create')->add(self::middleware('create', $args))->setName($routeNames.'.create');
46
-            $this->get('/{id:[0-9]+}', $controller . ':show')->add(self::middleware('show', $args))->setName($routeNames.'.show');
47
-            $this->get('/{id:[0-9]+}/edit', $controller . ':edit')->add(self::middleware('edit', $args))->setName($routeNames.'.edit');
48
-            $this->post('', $controller . ':store')->add(self::middleware('store', $args))->setName($routeNames.'.store');
49
-            $this->put('/{id:[0-9]+}', $controller . ':update')->add(self::middleware('update', $args))->setName($routeNames.'.update');
50
-            $this->patch('/{id:[0-9]+}', $controller . ':update')->add(self::middleware('index', $args))->setName($routeNames.'.update');
51
-            $this->delete('/{id:[0-9]+}', $controller . ':destroy')->add(self::middleware('destroy', $args))->setName($routeNames.'.destroy');
37
+        $url = rtrim($url, '/');
38
+        $routeNames = implode('.', explode('/', trim($url, '/')));
39
+
40
+        $this->app->group($url, function() use ($controller, $routeNames, $args) {
41
+            $this->get('', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames . '.index');
42
+            $this->get('/', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames . '.index');
43
+            $this->get('/index', $controller . ':index')->add(self::middleware('index', $args))->setName($routeNames . '.index');
44
+
45
+            $this->get('/create', $controller . ':create')->add(self::middleware('create', $args))->setName($routeNames . '.create');
46
+            $this->get('/{id:[0-9]+}', $controller . ':show')->add(self::middleware('show', $args))->setName($routeNames . '.show');
47
+            $this->get('/{id:[0-9]+}/edit', $controller . ':edit')->add(self::middleware('edit', $args))->setName($routeNames . '.edit');
48
+            $this->post('', $controller . ':store')->add(self::middleware('store', $args))->setName($routeNames . '.store');
49
+            $this->put('/{id:[0-9]+}', $controller . ':update')->add(self::middleware('update', $args))->setName($routeNames . '.update');
50
+            $this->patch('/{id:[0-9]+}', $controller . ':update')->add(self::middleware('index', $args))->setName($routeNames . '.update');
51
+            $this->delete('/{id:[0-9]+}', $controller . ':destroy')->add(self::middleware('destroy', $args))->setName($routeNames . '.destroy');
52 52
 
53 53
         })->add(self::middleware('group', $args));
54 54
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public static function middleware($middleWare = "group", $args)
62 62
     {
63
-        $routeResourceMiddleWare_default = function ($request, $response, $next) {
63
+        $routeResourceMiddleWare_default = function($request, $response, $next) {
64 64
             return $next($request, $response);
65 65
         };
66 66
 
Please login to merge, or discard this patch.
core/Functions/helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
     $dir = scandir($path);
7 7
     $ex_folders = array('..', '.');
8 8
 
9
-    return array_diff($dir,$ex_folders);
9
+    return array_diff($dir, $ex_folders);
10 10
 }
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
bootstrap/app.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2
-define('__APP_ROOT__',__DIR__ . '/../') ;
2
+define('__APP_ROOT__', __DIR__ . '/../');
3 3
 
4
-require  __APP_ROOT__.'bootstrap/bootstrap.php';
5
-require  __APP_ROOT__.'core/Functions/helpers.php';
6
-require __APP_ROOT__.'vendor/autoload.php';
7
-require __APP_ROOT__.'config/settings.php';
4
+require  __APP_ROOT__ . 'bootstrap/bootstrap.php';
5
+require  __APP_ROOT__ . 'core/Functions/helpers.php';
6
+require __APP_ROOT__ . 'vendor/autoload.php';
7
+require __APP_ROOT__ . 'config/settings.php';
8 8
 $app = new \Core\App($config);
9 9
 
10 10
 use SlimFacades\Facade;
11 11
 // get container app
12
-require __APP_ROOT__.'bootstrap/dependencies.php';
13
-require  __APP_ROOT__.'bootstrap/routes.php';
12
+require __APP_ROOT__ . 'bootstrap/dependencies.php';
13
+require  __APP_ROOT__ . 'bootstrap/routes.php';
14 14
 
15
-if(php_sapi_name() != 'cli') {
15
+if (php_sapi_name() != 'cli') {
16 16
     $settings['tracy']['path'] = '';
17
-    if($app->getContainer() instanceof Psr\Container\ContainerInterface){
17
+    if ($app->getContainer() instanceof Psr\Container\ContainerInterface) {
18 18
         $settings = $app->getContainer()->settings;
19 19
     }
20 20
     Tracy\Debugger::enable(Tracy\Debugger::DEVELOPMENT, $settings['tracy']['path']);
21 21
     Facade::setFacadeApplication($app);
22 22
 
23
-    require  __APP_ROOT__.'bootstrap/middlewares.php';
23
+    require  __APP_ROOT__ . 'bootstrap/middlewares.php';
24 24
 
25 25
     $app->run();
26 26
 
Please login to merge, or discard this patch.
bootstrap/routes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@
 block discarded – undo
27 27
 
28 28
 
29 29
 
30
-$files = getDirFiles(__APP_ROOT__.'app/Routes/');
30
+$files = getDirFiles(__APP_ROOT__ . 'app/Routes/');
31 31
 /** Route Partial Loadup =================================================== */
32 32
 foreach ($files as $partial) {
33
-    $file = __APP_ROOT__.'app/Routes/'.$partial;
33
+    $file = __APP_ROOT__ . 'app/Routes/' . $partial;
34 34
 
35
-    if ( ! file_exists($file))
35
+    if (!file_exists($file))
36 36
     {
37 37
         $msg = "Route partial [{$partial}] not found.";
38 38
         throw new \Illuminate\Filesystem\FileNotFoundException($msg);
Please login to merge, or discard this patch.