Completed
Push — master ( 605113...c21a7a )
by
unknown
87:53
created
src/SideNav.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @since 19 Sep 2016
47 47
      * @param $class
48 48
      */
49
-    public static function checkStatusObject($class,$method)
49
+    public static function checkStatusObject($class, $method)
50 50
     {
51 51
         self::$checkStatusObject = [
52 52
             'object' => $class,
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         self::$routes[self::$currentRoute] = [];
90 90
 
91 91
         // make menu array
92
-        $array = self::add($route,$callback);
92
+        $array = self::add($route, $callback);
93 93
 
94 94
         if (self::checkGroupId(self::$type))
95 95
             // add to the group render array
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
      * @param $callback
108 108
      * @param $checkCallback
109 109
      */
110
-    public static function registerWithCheckStatus($route , $callback , $checkCallback = null)
110
+    public static function registerWithCheckStatus($route, $callback, $checkCallback = null)
111 111
     {
112 112
         // check status of route
113
-        if (self::checkStatus($route,$checkCallback)){
113
+        if (self::checkStatus($route, $checkCallback)) {
114 114
             self::register($route, $callback);
115 115
         }
116 116
     }
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
     public static function addSub($route, $callback)
127 127
     {
128 128
         // register route name
129
-        array_push(self::$routes[self::$currentRoute],$route);
129
+        array_push(self::$routes[self::$currentRoute], $route);
130 130
 
131 131
         // return submenu array
132
-        return self::add($route,$callback);
132
+        return self::add($route, $callback);
133 133
     }
134 134
 
135 135
     /**
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      * @param $callback
141 141
      * @return array
142 142
      */
143
-    private static function add($route,$callback)
143
+    private static function add($route, $callback)
144 144
     {
145 145
         // instance of menu class
146 146
         $menu = new Menu;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     public static function routes()
162 162
     {
163 163
         // return json array of all routes-name
164
-        if(self::$resultType === 'json')
164
+        if (self::$resultType === 'json')
165 165
             return json_encode(self::$routes);
166 166
 
167 167
         // return array of all routes-name
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
      */
190 190
     public static function render($type = null)
191 191
     {
192
-        if(self::checkGroupId($type))
192
+        if (self::checkGroupId($type))
193 193
         {
194 194
 
195 195
             // render the menu json array
196
-            if(self::$resultType === 'json')
196
+            if (self::$resultType === 'json')
197 197
                 return json_encode(self::$menu[$type]);
198 198
 
199 199
             // render the menu array
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         }
202 202
 
203 203
         // return single menu json array
204
-        if(self::$resultType === 'json')
204
+        if (self::$resultType === 'json')
205 205
             return json_encode(self::$menu);
206 206
 
207 207
         // return single menu array
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      */
217 217
     public static function checkGroupId($type)
218 218
     {
219
-        if($type !== null && isset(self::$type))
219
+        if ($type !== null && isset(self::$type))
220 220
             return true;
221 221
 
222 222
         return false;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      * @param $callback
231 231
      * @return bool
232 232
      */
233
-    public static function checkStatus($route,$callback = false)
233
+    public static function checkStatus($route, $callback = false)
234 234
     {
235 235
         if ($callback instanceof \Closure) {
236 236
             if ($callback())
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         // check status method name
244 244
         $method = self::$checkStatusObject['method'];
245 245
 
246
-        if(class_exists($obj)) {
246
+        if (class_exists($obj)) {
247 247
             // instance of class
248 248
             $class = new $obj;
249 249
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -91,9 +91,10 @@  discard block
 block discarded – undo
91 91
         // make menu array
92 92
         $array = self::add($route,$callback);
93 93
 
94
-        if (self::checkGroupId(self::$type))
95
-            // add to the group render array
94
+        if (self::checkGroupId(self::$type)) {
95
+                    // add to the group render array
96 96
             array_push(self::$menu[self::$type], $array);
97
+        }
97 98
 
98 99
         // add to the single render array
99 100
         array_push(self::$menu, $array);
@@ -161,8 +162,9 @@  discard block
 block discarded – undo
161 162
     public static function routes()
162 163
     {
163 164
         // return json array of all routes-name
164
-        if(self::$resultType === 'json')
165
-            return json_encode(self::$routes);
165
+        if(self::$resultType === 'json') {
166
+                    return json_encode(self::$routes);
167
+        }
166 168
 
167 169
         // return array of all routes-name
168 170
         return self::$routes;
@@ -193,16 +195,18 @@  discard block
 block discarded – undo
193 195
         {
194 196
 
195 197
             // render the menu json array
196
-            if(self::$resultType === 'json')
197
-                return json_encode(self::$menu[$type]);
198
+            if(self::$resultType === 'json') {
199
+                            return json_encode(self::$menu[$type]);
200
+            }
198 201
 
199 202
             // render the menu array
200 203
             return self::$menu[$type];
201 204
         }
202 205
 
203 206
         // return single menu json array
204
-        if(self::$resultType === 'json')
205
-            return json_encode(self::$menu);
207
+        if(self::$resultType === 'json') {
208
+                    return json_encode(self::$menu);
209
+        }
206 210
 
207 211
         // return single menu array
208 212
         return self::$menu[0];
@@ -216,8 +220,9 @@  discard block
 block discarded – undo
216 220
      */
217 221
     public static function checkGroupId($type)
218 222
     {
219
-        if($type !== null && isset(self::$type))
220
-            return true;
223
+        if($type !== null && isset(self::$type)) {
224
+                    return true;
225
+        }
221 226
 
222 227
         return false;
223 228
     }
@@ -233,8 +238,9 @@  discard block
 block discarded – undo
233 238
     public static function checkStatus($route,$callback = false)
234 239
     {
235 240
         if ($callback instanceof \Closure) {
236
-            if ($callback())
237
-                return true;
241
+            if ($callback()) {
242
+                            return true;
243
+            }
238 244
         }
239 245
 
240 246
         // check status class name
@@ -248,8 +254,9 @@  discard block
 block discarded – undo
248 254
             $class = new $obj;
249 255
 
250 256
             // call method of class
251
-            if ($class->$method($route))
252
-                return true;
257
+            if ($class->$method($route)) {
258
+                            return true;
259
+            }
253 260
             return false;
254 261
         } else {
255 262
             throw new \Exception("The CheckStatus class not found !");
Please login to merge, or discard this patch.