@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @since 19 Sep 2016 |
| 44 | 44 | * @param $class |
| 45 | 45 | */ |
| 46 | - public static function checkStatusObject($class,$method) |
|
| 46 | + public static function checkStatusObject($class, $method) |
|
| 47 | 47 | { |
| 48 | 48 | self::$checkStatusObject = [ |
| 49 | 49 | 'object' => $class, |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | self::$routes[self::$currentRoute] = []; |
| 87 | 87 | |
| 88 | 88 | // make menu array |
| 89 | - $array = self::add($route,$callback); |
|
| 89 | + $array = self::add($route, $callback); |
|
| 90 | 90 | |
| 91 | 91 | if (self::checkGroupId(self::$group)) |
| 92 | 92 | // add to the group render array |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | * @param $callback |
| 105 | 105 | * @param $checkCallback |
| 106 | 106 | */ |
| 107 | - public static function registerWithCheck($route , $callback , $checkCallback = null) |
|
| 107 | + public static function registerWithCheck($route, $callback, $checkCallback = null) |
|
| 108 | 108 | { |
| 109 | 109 | // check status of route |
| 110 | - if (self::checkStatus($route,$checkCallback)){ |
|
| 110 | + if (self::checkStatus($route, $checkCallback)) { |
|
| 111 | 111 | self::register($route, $callback); |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | public static function addSub($route, $callback) |
| 124 | 124 | { |
| 125 | 125 | // register route name |
| 126 | - array_push(self::$routes[self::$currentRoute],$route); |
|
| 126 | + array_push(self::$routes[self::$currentRoute], $route); |
|
| 127 | 127 | |
| 128 | 128 | // return submenu array |
| 129 | - return self::add($route,$callback); |
|
| 129 | + return self::add($route, $callback); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param $callback |
| 138 | 138 | * @return array |
| 139 | 139 | */ |
| 140 | - private static function add($route,$callback) |
|
| 140 | + private static function add($route, $callback) |
|
| 141 | 141 | { |
| 142 | 142 | // instance of menu class |
| 143 | 143 | $menu = new Menu; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public static function routes($index = null) |
| 159 | 159 | { |
| 160 | - if($index !== null) |
|
| 160 | + if ($index !== null) |
|
| 161 | 161 | return self::$routes[$index]; |
| 162 | 162 | |
| 163 | 163 | // return array of all routes-name |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | public static function checkGroupId($type) |
| 187 | 187 | { |
| 188 | - if($type !== null && isset(self::$group)) |
|
| 188 | + if ($type !== null && isset(self::$group)) |
|
| 189 | 189 | return true; |
| 190 | 190 | |
| 191 | 191 | return false; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @param $callback |
| 200 | 200 | * @return bool |
| 201 | 201 | */ |
| 202 | - public static function checkStatus($route,$callback = false) |
|
| 202 | + public static function checkStatus($route, $callback = false) |
|
| 203 | 203 | { |
| 204 | 204 | if ($callback instanceof \Closure) { |
| 205 | 205 | if ($callback()) |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | // check status method name |
| 213 | 213 | $method = self::$checkStatusObject['method']; |
| 214 | 214 | |
| 215 | - if(class_exists($obj)) { |
|
| 215 | + if (class_exists($obj)) { |
|
| 216 | 216 | // instance of class |
| 217 | 217 | $class = new $obj; |
| 218 | 218 | |
@@ -88,9 +88,10 @@ discard block |
||
| 88 | 88 | // make menu array |
| 89 | 89 | $array = self::add($route,$callback); |
| 90 | 90 | |
| 91 | - if (self::checkGroupId(self::$group)) |
|
| 92 | - // add to the group render array |
|
| 91 | + if (self::checkGroupId(self::$group)) { |
|
| 92 | + // add to the group render array |
|
| 93 | 93 | array_push(self::$menu[self::$group], $array); |
| 94 | + } |
|
| 94 | 95 | |
| 95 | 96 | // add to the single render array |
| 96 | 97 | array_push(self::$menu, $array); |
@@ -157,8 +158,9 @@ discard block |
||
| 157 | 158 | */ |
| 158 | 159 | public static function routes($index = null) |
| 159 | 160 | { |
| 160 | - if($index !== null) |
|
| 161 | - return self::$routes[$index]; |
|
| 161 | + if($index !== null) { |
|
| 162 | + return self::$routes[$index]; |
|
| 163 | + } |
|
| 162 | 164 | |
| 163 | 165 | // return array of all routes-name |
| 164 | 166 | return self::$routes; |
@@ -185,8 +187,9 @@ discard block |
||
| 185 | 187 | */ |
| 186 | 188 | public static function checkGroupId($type) |
| 187 | 189 | { |
| 188 | - if($type !== null && isset(self::$group)) |
|
| 189 | - return true; |
|
| 190 | + if($type !== null && isset(self::$group)) { |
|
| 191 | + return true; |
|
| 192 | + } |
|
| 190 | 193 | |
| 191 | 194 | return false; |
| 192 | 195 | } |
@@ -202,8 +205,9 @@ discard block |
||
| 202 | 205 | public static function checkStatus($route,$callback = false) |
| 203 | 206 | { |
| 204 | 207 | if ($callback instanceof \Closure) { |
| 205 | - if ($callback()) |
|
| 206 | - return true; |
|
| 208 | + if ($callback()) { |
|
| 209 | + return true; |
|
| 210 | + } |
|
| 207 | 211 | } |
| 208 | 212 | |
| 209 | 213 | // check status class name |
@@ -217,8 +221,9 @@ discard block |
||
| 217 | 221 | $class = new $obj; |
| 218 | 222 | |
| 219 | 223 | // call method of class |
| 220 | - if ($class->$method($route)) |
|
| 221 | - return true; |
|
| 224 | + if ($class->$method($route)) { |
|
| 225 | + return true; |
|
| 226 | + } |
|
| 222 | 227 | return false; |
| 223 | 228 | } else { |
| 224 | 229 | throw new \Exception("The CheckStatus class not found !"); |