Completed
Push — master ( 2076b7...2510e5 )
by Afshin
02:23
created
core/Facades/Auth.php 1 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
      * @param Core\Services\AuthService\AuthService
17 17
      * @return AuthService
18
-    */
18
+     */
19 19
     protected static function getFacadeAccessor()
20 20
     {
21 21
         return 'AuthService';
Please login to merge, or discard this patch.
core/Handlers/Session/SessionHandler.php 3 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,11 +15,13 @@
 block discarded – undo
15 15
 {
16 16
     public function get($key = null)
17 17
     {
18
-        if(!isset($_SESSION)) return [];
18
+        if(!isset($_SESSION)) {
19
+            return [];
20
+        }
19 21
 
20 22
         if(!$key){
21 23
             return $_SESSION;
22
-        }else{
24
+        } else{
23 25
             $keys = explode('.',$key);
24 26
             $sessionVal = $this->getRecursiveSessionKey($_SESSION,$keys);
25 27
             return $sessionVal;
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,12 +34,12 @@
 block discarded – undo
34 34
 
35 35
     public function exists($key,$val)
36 36
     {
37
-       $keySession = $this->get($key);
37
+        $keySession = $this->get($key);
38 38
 
39
-       if($keySession){
40
-          return true;
41
-       }
42
-       return false;
39
+        if($keySession){
40
+            return true;
41
+        }
42
+        return false;
43 43
     }
44 44
 
45 45
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,28 +15,28 @@
 block discarded – undo
15 15
 {
16 16
     public function get($key = null)
17 17
     {
18
-        if(!isset($_SESSION)) return [];
18
+        if (!isset($_SESSION)) return [];
19 19
 
20
-        if(!$key){
20
+        if (!$key) {
21 21
             return $_SESSION;
22
-        }else{
23
-            $keys = explode('.',$key);
24
-            $sessionVal = $this->getRecursiveSessionKey($_SESSION,$keys);
22
+        }else {
23
+            $keys = explode('.', $key);
24
+            $sessionVal = $this->getRecursiveSessionKey($_SESSION, $keys);
25 25
             return $sessionVal;
26 26
         }
27 27
     }
28 28
 
29
-    public function set($key,$val)
29
+    public function set($key, $val)
30 30
     {
31
-        $_SESSION = $this->setArr($key,$val);
31
+        $_SESSION = $this->setArr($key, $val);
32 32
     }
33 33
 
34 34
 
35
-    public function exists($key,$val)
35
+    public function exists($key, $val)
36 36
     {
37 37
        $keySession = $this->get($key);
38 38
 
39
-       if($keySession){
39
+       if ($keySession) {
40 40
           return true;
41 41
        }
42 42
        return false;
Please login to merge, or discard this patch.
core/Services/Session.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     {
18 18
         $namespace = 'Core\\Handlers\\Session\\';
19 19
 
20
-        $className = $namespace.ucfirst($driver).'Handler';
20
+        $className = $namespace . ucfirst($driver) . 'Handler';
21 21
         $this->handler = new $className();
22 22
 
23 23
         return $this->handler;
Please login to merge, or discard this patch.
core/Interfaces/AbstractSession.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 class AbstractSession
13 13
 {
14 14
 
15
-     public function getRecursiveSessionKey($data , $keyArr){
15
+        public function getRecursiveSessionKey($data , $keyArr){
16 16
         $arrayFound  = isset($data[$keyArr[0]]) ? $data[$keyArr[0]] : '';
17 17
         if($arrayFound){
18 18
             unset($keyArr[0]);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,16 +12,16 @@  discard block
 block discarded – undo
12 12
 class AbstractSession
13 13
 {
14 14
 
15
-     public function getRecursiveSessionKey($data , $keyArr){
16
-        $arrayFound  = isset($data[$keyArr[0]]) ? $data[$keyArr[0]] : '';
17
-        if($arrayFound){
15
+     public function getRecursiveSessionKey($data, $keyArr) {
16
+        $arrayFound = isset($data[$keyArr[0]]) ? $data[$keyArr[0]] : '';
17
+        if ($arrayFound) {
18 18
             unset($keyArr[0]);
19 19
             $keyArr = array_values($keyArr);
20
-            if(isset($keyArr[0])){
21
-                return $this->getRecursiveSessionKey($arrayFound,$keyArr);
20
+            if (isset($keyArr[0])) {
21
+                return $this->getRecursiveSessionKey($arrayFound, $keyArr);
22 22
             }
23 23
         }
24
-        return $arrayFound ;
24
+        return $arrayFound;
25 25
     }
26 26
 
27 27
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
                 $sourceRef = &$source;
34 34
             }
35 35
             $keyName = trim($keyName);
36
-            $sourceRef  = &$sourceRef[$keyName];
36
+            $sourceRef = &$sourceRef[$keyName];
37 37
         }
38 38
         $sourceRef = $value;
39 39
         unset($sourceRef);
Please login to merge, or discard this patch.
core/ModuleInitializer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     protected $moduleInstances = [];
33 33
 
34
-    public function __construct($app, $modules=array())
34
+    public function __construct($app, $modules = array())
35 35
     {
36 36
         $this->app = $app;
37 37
         // build an class map of [[module => moduleClassPath], ..]
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         }
93 93
 
94 94
         $allSettings['modules'] = array_merge_recursive($allSettings['modules'], $this->getModuleConfig());
95
-        $container['settings']->__construct( $allSettings );
95
+        $container['settings']->__construct($allSettings);
96 96
     }
97 97
 
98 98
     /**
Please login to merge, or discard this patch.
core/Services/AuthService.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
 
23 23
     public function hasRole($roleName)
24 24
     {
25
-        if(!self::check()){
25
+        if (!self::check()) {
26 26
             return false;
27 27
         }
28
-        $userRoles =  UserDataAccess::getUserRoles(isset($_SESSION['user']['user_id']) ? $_SESSION['user']['user_id'] : 0);
28
+        $userRoles = UserDataAccess::getUserRoles(isset($_SESSION['user']['user_id']) ? $_SESSION['user']['user_id'] : 0);
29 29
         $hasAccess = false;
30
-        foreach ($userRoles as $role){
31
-            if($role->name == $roleName){
30
+        foreach ($userRoles as $role) {
31
+            if ($role->name == $roleName) {
32 32
                 $hasAccess = true;
33 33
                 break;
34 34
             }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         return isset($_SESSION['user']['user_id']);
43 43
     }
44 44
 
45
-    public function attempt(string $loginField,string $password)
45
+    public function attempt(string $loginField, string $password)
46 46
     {
47 47
         $user = UserDataAccess::getUserLoginField($loginField);
48 48
         if (!$user) {
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
             ];
53 53
         }
54 54
         $setting = Config::get('settings.auth');
55
-        if($setting['2step']){
56
-            return $this->twoStepAuth($loginField,$password);
57
-        }else{
58
-            if ($this->checkPass($password,$user->password)) {
55
+        if ($setting['2step']) {
56
+            return $this->twoStepAuth($loginField, $password);
57
+        }else {
58
+            if ($this->checkPass($password, $user->password)) {
59 59
                 $_SESSION['user']['user_id'] = $user->id;
60 60
                 $_SESSION['user']['mobile'] = $user->mobile;
61 61
                 return [
62 62
                     'type'=>'success',
63 63
                     'message'=> 'Logined',
64 64
                 ];
65
-            }else{
65
+            }else {
66 66
                 return [
67 67
                     'type'=>'error',
68 68
                     'message'=> 'password mismatch',
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 
78 78
 
79 79
 
80
-    public function checkPass($password,$database_pass)
80
+    public function checkPass($password, $database_pass)
81 81
     {
82
-        if($database_pass == $password){
82
+        if ($database_pass == $password) {
83 83
             return true;
84 84
         }
85 85
         return false;
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
     }
88 88
 
89 89
 
90
-    public function twoStepAuth(string $loginField,string $password)
90
+    public function twoStepAuth(string $loginField, string $password)
91 91
     {
92 92
         $user = UserDataAccess::getUserLoginField($loginField);
93 93
 
94
-        if(UserDataAccess::checkToken($password,$loginField)){
94
+        if (UserDataAccess::checkToken($password, $loginField)) {
95 95
             $_SESSION['user']['user_id'] = $user->id;
96 96
             $_SESSION['user']['mobile'] = $user->mobile;
97 97
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                 'type'=>'success',
101 101
                 'message'=> 'Logined',
102 102
             ];
103
-        }else{
103
+        }else {
104 104
             return [
105 105
                 'type'=>'error',
106 106
                 'message'=> 'problem!',
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $setting = Config::get('settings.auth');
55 55
         if($setting['2step']){
56 56
             return $this->twoStepAuth($loginField,$password);
57
-        }else{
57
+        } else{
58 58
             if ($this->checkPass($password,$user->password)) {
59 59
                 $_SESSION['user']['user_id'] = $user->id;
60 60
                 $_SESSION['user']['mobile'] = $user->mobile;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                     'type'=>'success',
63 63
                     'message'=> 'Logined',
64 64
                 ];
65
-            }else{
65
+            } else{
66 66
                 return [
67 67
                     'type'=>'error',
68 68
                     'message'=> 'password mismatch',
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                 'type'=>'success',
101 101
                 'message'=> 'Logined',
102 102
             ];
103
-        }else{
103
+        } else{
104 104
             return [
105 105
                 'type'=>'error',
106 106
                 'message'=> 'problem!',
Please login to merge, or discard this patch.
core/Config.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@
 block discarded – undo
10 10
 
11 11
 class Config {
12 12
 
13
-    public static function get($key,$default = null){
14
-        $path = __APP_ROOT__ . '/config/'.$key[0].'.php';
13
+    public static function get($key, $default = null) {
14
+        $path = __APP_ROOT__ . '/config/' . $key[0] . '.php';
15 15
         $result = include_once $path;
16
-        foreach (explode('.' , $key) as $segment) {
17
-            if(isset($result[$segment]))
16
+        foreach (explode('.', $key) as $segment) {
17
+            if (isset($result[$segment]))
18 18
                 $result = $result[$segment];
19 19
             else
20 20
                 $result = $default;
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,10 +14,11 @@
 block discarded – undo
14 14
         $path = __APP_ROOT__ . '/config/'.$key[0].'.php';
15 15
         $result = include_once $path;
16 16
         foreach (explode('.' , $key) as $segment) {
17
-            if(isset($result[$segment]))
18
-                $result = $result[$segment];
19
-            else
20
-                $result = $default;
17
+            if(isset($result[$segment])) {
18
+                            $result = $result[$segment];
19
+            } else {
20
+                            $result = $default;
21
+            }
21 22
         }
22 23
         return $result;
23 24
     }
Please login to merge, or discard this patch.
database/migrations/20171228211415_Add_Has_Pic_To_Users_Table_Migration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     {
13 13
         Capsule::schema()->table('users', function($table)
14 14
         {
15
-            $table->enum('has_pic',['no','yes'])->default('no');
15
+            $table->enum('has_pic', ['no', 'yes'])->default('no');
16 16
         });
17 17
     }
18 18
 
Please login to merge, or discard this patch.
core/Facades/Image.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
     /**
9 9
      * @param Core\Services\AuthService\AuthService
10 10
      * @return AuthService
11
-    */
11
+     */
12 12
     protected static function getFacadeAccessor()
13 13
     {
14 14
         return 'ImageService';
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Core\Facades;
3 3
 
4
-use Core\Services\ImageService  ;
4
+use Core\Services\ImageService;
5 5
 use SlimFacades\Facade;
6 6
 class Image extends Facade
7 7
 {
Please login to merge, or discard this patch.