Completed
Push — master ( a01d20...d3dfe8 )
by Afshin
02:23
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.
bootstrap/app.php 1 patch
Spacing   +9 added lines, -9 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__.'vendor/autoload.php';
6
-require __APP_ROOT__.'config/settings.php';
4
+require  __APP_ROOT__ . 'bootstrap/bootstrap.php';
5
+require __APP_ROOT__ . 'vendor/autoload.php';
6
+require __APP_ROOT__ . 'config/settings.php';
7 7
 $app = new \Core\App($config);
8 8
 
9 9
 use SlimFacades\Facade;
10 10
 
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   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 
27 27
 
28 28
 $route->post('/console', 'RunTracy\Controllers\RunTracyConsole:index');
29
-$route->get('/', HomeController::class.':index');
30
-$route->get('/register[/{params:.*}]', \App\Controller\User\AuthController::class.':get_register_Action');
31
-$route->post('/register', \App\Controller\User\AuthController::class.':post_register_Action');
32
-$route->get('/login', \App\Controller\User\AuthController::class.':get_login_Action');
33
-$route->post('/login', \App\Controller\User\AuthController::class.':post_login_Action')->setName('post.login');
29
+$route->get('/', HomeController::class . ':index');
30
+$route->get('/register[/{params:.*}]', \App\Controller\User\AuthController::class . ':get_register_Action');
31
+$route->post('/register', \App\Controller\User\AuthController::class . ':post_register_Action');
32
+$route->get('/login', \App\Controller\User\AuthController::class . ':get_login_Action');
33
+$route->post('/login', \App\Controller\User\AuthController::class . ':post_login_Action')->setName('post.login');
34 34
 
Please login to merge, or discard this patch.