Passed
Push — master ( 682e6e...b39fed )
by Afshin
02:11
created
core/Interfaces/_Controller.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -104,9 +104,9 @@
 block discarded – undo
104 104
         $protocol = $request->getUri()->getScheme();
105 105
         $baseHost = $request->getUri()->getHost();
106 106
         $path = $request->getUri()->getPath();
107
-        $pathArr = explode('/',$path);
108
-        unset($pathArr[count($pathArr)-1]);
109
-        $path = implode('/',$pathArr);
107
+        $pathArr = explode('/', $path);
108
+        unset($pathArr[count($pathArr) - 1]);
109
+        $path = implode('/', $pathArr);
110 110
         $port = $request->getUri()->getPort() ? ':' . $request->getUri()->getPort() : '';
111 111
         $baseUrl = $protocol . '://' . $baseHost . $port . $path;
112 112
         return $baseUrl;
Please login to merge, or discard this patch.
core/Translator/Translator.php 3 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,40 +19,40 @@  discard block
 block discarded – undo
19 19
     }
20 20
 
21 21
 
22
-    private function _loadkey(string $key , array $replace = [])
22
+    private function _loadkey(string $key, array $replace = [])
23 23
     {
24
-        list($namespace,$group) = explode('.',$key);
24
+        list($namespace, $group) = explode('.', $key);
25 25
         $t_dir = $this->getTranslation_dirs();
26 26
 
27
-        if(in_array($this->local,$t_dir)){
27
+        if (in_array($this->local, $t_dir)) {
28 28
 
29
-            $translationBaseFolder = $this->settings['translation']['translations_path'].$this->local;
30
-            $translationBaseFile = $translationBaseFolder.'/'.$namespace.'.php';
29
+            $translationBaseFolder = $this->settings['translation']['translations_path'] . $this->local;
30
+            $translationBaseFile = $translationBaseFolder . '/' . $namespace . '.php';
31 31
 
32
-            if(file_exists($translationBaseFolder)){
33
-                $lang= include_once ($translationBaseFile);
34
-            }else{
32
+            if (file_exists($translationBaseFolder)) {
33
+                $lang = include_once ($translationBaseFile);
34
+            }else {
35 35
 
36 36
             }
37
-        }else{
37
+        }else {
38 38
 
39 39
         }
40 40
 
41 41
 
42
-        if(count($replace) > 0){
43
-            foreach($replace as $key=>$replace_item){
44
-                if(strpos($lang[$group],'%') != 0){
45
-                    str_replace($key,$replace_item,$lang[$group]);
42
+        if (count($replace) > 0) {
43
+            foreach ($replace as $key=>$replace_item) {
44
+                if (strpos($lang[$group], '%') != 0) {
45
+                    str_replace($key, $replace_item, $lang[$group]);
46 46
                 }
47 47
             }
48
-        }else{
48
+        }else {
49 49
             return $lang[$group];
50 50
         }
51 51
     }
52 52
 
53 53
     public function trans(string $key, array $replace = [])
54 54
     {
55
-        return $this->_loadkey($key,$replace);
55
+        return $this->_loadkey($key, $replace);
56 56
     }
57 57
 
58 58
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 
66 66
 
67
-        return array_diff($dir,$ex_folders);
67
+        return array_diff($dir, $ex_folders);
68 68
     }
69 69
 
70 70
 }
71 71
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 
32 32
             if(file_exists($translationBaseFolder)){
33 33
                 $lang= include_once ($translationBaseFile);
34
-            }else{
34
+            } else{
35 35
 
36 36
             }
37
-        }else{
37
+        } else{
38 38
 
39 39
         }
40 40
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                     str_replace($key,$replace_item,$lang[$group]);
46 46
                 }
47 47
             }
48
-        }else{
48
+        } else{
49 49
             return $lang[$group];
50 50
         }
51 51
     }
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     /**
16 16
      * @var ContainerInterface $setting
17 17
      *
18
-    */
18
+     */
19 19
     public function init()
20 20
     {
21 21
         $setting = $this->settings['translation'];
Please login to merge, or discard this patch.
core/Config.php 2 patches
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,10 +21,11 @@
 block discarded – undo
21 21
     public static function get($key,$default = null){
22 22
         $result = self::$config;
23 23
         foreach (explode('.' , $key) as $segment) {
24
-            if(isset($result[$segment]))
25
-                $result = $result[$segment];
26
-            else
27
-                $result = $default;
24
+            if(isset($result[$segment])) {
25
+                            $result = $result[$segment];
26
+            } else {
27
+                            $result = $default;
28
+            }
28 29
         }
29 30
         return $result;
30 31
     }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@
 block discarded – undo
10 10
 
11 11
 class Config {
12 12
     private static $config = array();
13
-    private function __construct(){}
14
-    public static function load($path = null){
13
+    private function __construct() {}
14
+    public static function load($path = null) {
15 15
         $path = ($path) ?: __APP_ROOT__ . '/config/*';
16 16
         foreach (glob($path) as $file) {
17 17
             $config = include $file;
18 18
             self::$config = array_merge(self::$config, $config);
19 19
         }
20 20
     }
21
-    public static function get($key,$default = null){
21
+    public static function get($key, $default = null) {
22 22
         $result = self::$config;
23
-        foreach (explode('.' , $key) as $segment) {
24
-            if(isset($result[$segment]))
23
+        foreach (explode('.', $key) as $segment) {
24
+            if (isset($result[$segment]))
25 25
                 $result = $result[$segment];
26 26
             else
27 27
                 $result = $default;
Please login to merge, or discard this patch.
config/phpmig.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
5 5
 use Phpmig\Adapter;
6 6
 use Illuminate\Database\Capsule\Manager as Capsule;
7 7
 include 'settings.php';
8
-$capsule   = new Capsule;
8
+$capsule = new Capsule;
9 9
 $capsule->addConnection($config['settings']['db']);
10 10
 $capsule->setAsGlobal();
11 11
 $capsule->bootEloquent();
12 12
 $container = new ArrayObject();
13 13
 $container['phpmig.adapter'] = new Adapter\Illuminate\Database($capsule, 'migrations');
14
-$container['phpmig.migrations_path'] =  'database/migrations';
14
+$container['phpmig.migrations_path'] = 'database/migrations';
15 15
 $container['phpmig.migrations_template_path'] = 'core/resources/templates/create_migration.txt';
16 16
 return $container;
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
config/settings.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
             'path' => __DIR__ . '/../storage/logs/app.log',
24 24
         ],
25 25
         'db' => [
26
-            'driver'    => $env($APPROOT,'DB_DRIVER', 'mysql'),
27
-            'host'      => $env($APPROOT,'DB_HOST', 'localhost'),
28
-            'database'  => $env($APPROOT,'DB_NAME', 'cafesaba'),
29
-            'username'  => $env($APPROOT,'DB_USERNAME', 'root'),
30
-            'password'  => $env($APPROOT,'DB_PASS', 'root'),
31
-            'charset'   => $env($APPROOT,'DB_CHARSET', 'utf8'),
32
-            'collation' => $env($APPROOT,'DB_COLLATION', 'utf8_unicode_ci'),
33
-            'prefix'    => $env($APPROOT,'DB_PREFIX', ''),
34
-            'port'      => $env($APPROOT,'DB_PORT', 3306),
26
+            'driver'    => $env($APPROOT, 'DB_DRIVER', 'mysql'),
27
+            'host'      => $env($APPROOT, 'DB_HOST', 'localhost'),
28
+            'database'  => $env($APPROOT, 'DB_NAME', 'cafesaba'),
29
+            'username'  => $env($APPROOT, 'DB_USERNAME', 'root'),
30
+            'password'  => $env($APPROOT, 'DB_PASS', 'root'),
31
+            'charset'   => $env($APPROOT, 'DB_CHARSET', 'utf8'),
32
+            'collation' => $env($APPROOT, 'DB_COLLATION', 'utf8_unicode_ci'),
33
+            'prefix'    => $env($APPROOT, 'DB_PREFIX', ''),
34
+            'port'      => $env($APPROOT, 'DB_PORT', 3306),
35 35
         ],
36 36
         'view' => [
37 37
             'path' 	 => '../app/View',
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
             'showSlimEnvironmentPanel' => 1,
50 50
             'showSlimRequestPanel' => 1,
51 51
             'showSlimResponsePanel' => 1,
52
-            'showSlimContainer' =>1 ,
52
+            'showSlimContainer' =>1,
53 53
             'showEloquentORMPanel' => 1,
54
-            'showIdiormPanel' => 0,// > 0 mean you enable logging
54
+            'showIdiormPanel' => 0, // > 0 mean you enable logging
55 55
             // but show or not panel you decide in browser in panel selector
56
-            'showDoctrinePanel' => 'em',// here also enable logging and you must enter your Doctrine container name
56
+            'showDoctrinePanel' => 'em', // here also enable logging and you must enter your Doctrine container name
57 57
             // and also as above show or not panel you decide in browser in panel selector
58 58
             'showProfilerPanel' => 1,
59 59
             'showVendorVersionsPanel' => 1,
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/routes.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,18 +2,18 @@
 block discarded – undo
2 2
 use App\Controller\HomeController;
3 3
 $route = new \Core\Route($app);
4 4
 
5
-$files = getDirFiles(__APP_ROOT__.'app/Routes/');
5
+$files = getDirFiles(__APP_ROOT__ . 'app/Routes/');
6 6
 /** Route Partial Loadup =================================================== */
7 7
 foreach ($files as $partial) {
8
-    $file = __APP_ROOT__.'app/Routes/'.$partial;
8
+    $file = __APP_ROOT__ . 'app/Routes/' . $partial;
9 9
 
10
-    if ( ! file_exists($file))
10
+    if (!file_exists($file))
11 11
     {
12 12
         $msg = "Route partial [{$partial}] not found.";
13 13
     }
14 14
     include $file;
15 15
 }
16
-$route->get('/', HomeController::class.':index')->setName('home');
16
+$route->get('/', HomeController::class . ':index')->setName('home');
17 17
 
18 18
 $route->resource('/user/auth', '\App\Controller\User\AuthController', $args = []);
19 19
 
Please login to merge, or discard this patch.
core/Helpers/Env.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
11 11
 
12 12
 class Env
13 13
 {
14
-    public function __invoke($filePath ,$key, $default = null)
14
+    public function __invoke($filePath, $key, $default = null)
15 15
     {
16 16
 
17 17
         if (file_exists($filePath . '/.env')) {
18
-            $_dotenv = new Dotenv($filePath );
18
+            $_dotenv = new Dotenv($filePath);
19 19
             $_dotenv->load();
20 20
             unset($_dotenv);
21 21
         }else {
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
             $_dotenv = new Dotenv($filePath );
19 19
             $_dotenv->load();
20 20
             unset($_dotenv);
21
-        }else {
21
+        } else {
22 22
             return '';
23 23
         }
24 24
 
Please login to merge, or discard this patch.