@@ -174,8 +174,9 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $submenu = null; |
| 176 | 176 | |
| 177 | - if(!empty($this->submenu)) |
|
| 178 | - $submenu = $this->submenu; |
|
| 177 | + if(!empty($this->submenu)) { |
|
| 178 | + $submenu = $this->submenu; |
|
| 179 | + } |
|
| 179 | 180 | |
| 180 | 181 | $result = [ |
| 181 | 182 | 'name' => $this->route, |
@@ -189,8 +190,9 @@ discard block |
||
| 189 | 190 | 'sub' => $submenu |
| 190 | 191 | ]; |
| 191 | 192 | |
| 192 | - if(empty($this->submenu)) |
|
| 193 | - unset($result['sub']); |
|
| 193 | + if(empty($this->submenu)) { |
|
| 194 | + unset($result['sub']); |
|
| 195 | + } |
|
| 194 | 196 | |
| 195 | 197 | return $result; |
| 196 | 198 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | public function sub($route, $callback) |
| 57 | 57 | { |
| 58 | 58 | $sub = SideNav::addSub($route, $callback); |
| 59 | - array_push($this->submenu,$sub); |
|
| 59 | + array_push($this->submenu, $sub); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function subWithCheckStatus($route, $callback) |
| 70 | 70 | { |
| 71 | - if(SideNav::checkStatus($route) === true) |
|
| 71 | + if (SideNav::checkStatus($route) === true) |
|
| 72 | 72 | { |
| 73 | 73 | $sub = SideNav::addSub($route, $callback); |
| 74 | - array_push($this->submenu,$sub); |
|
| 74 | + array_push($this->submenu, $sub); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | $submenu = null; |
| 204 | 204 | |
| 205 | - if(!empty($this->submenu)) |
|
| 205 | + if (!empty($this->submenu)) |
|
| 206 | 206 | $submenu = $this->submenu; |
| 207 | 207 | |
| 208 | 208 | $result = [ |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | 'sub' => $submenu |
| 218 | 218 | ]; |
| 219 | 219 | |
| 220 | - if(empty($this->submenu)) |
|
| 220 | + if (empty($this->submenu)) |
|
| 221 | 221 | unset($result['sub']); |
| 222 | 222 | |
| 223 | 223 | return $result; |
@@ -79,9 +79,10 @@ discard block |
||
| 79 | 79 | // make menu array |
| 80 | 80 | $array = self::add($route,$callback); |
| 81 | 81 | |
| 82 | - if (self::checkGroupId(self::$type)) |
|
| 83 | - // add to the group render array |
|
| 82 | + if (self::checkGroupId(self::$type)) { |
|
| 83 | + // add to the group render array |
|
| 84 | 84 | array_push(self::$menu[self::$type], $array); |
| 85 | + } |
|
| 85 | 86 | |
| 86 | 87 | // add to the single render array |
| 87 | 88 | array_push(self::$menu, $array); |
@@ -141,8 +142,9 @@ discard block |
||
| 141 | 142 | public static function routes() |
| 142 | 143 | { |
| 143 | 144 | // return json array of all routes-name |
| 144 | - if(self::$resultType === 'json') |
|
| 145 | - return json_encode(self::$routes); |
|
| 145 | + if(self::$resultType === 'json') { |
|
| 146 | + return json_encode(self::$routes); |
|
| 147 | + } |
|
| 146 | 148 | |
| 147 | 149 | // return array of all routes-name |
| 148 | 150 | return self::$routes; |
@@ -163,16 +165,18 @@ discard block |
||
| 163 | 165 | if(self::checkGroupId($type)) { |
| 164 | 166 | |
| 165 | 167 | // render the menu json array |
| 166 | - if(self::$resultType === 'json') |
|
| 167 | - return json_encode(self::$menu[$type]); |
|
| 168 | + if(self::$resultType === 'json') { |
|
| 169 | + return json_encode(self::$menu[$type]); |
|
| 170 | + } |
|
| 168 | 171 | |
| 169 | 172 | // render the menu array |
| 170 | 173 | return self::$menu[$type]; |
| 171 | 174 | } |
| 172 | 175 | |
| 173 | 176 | // return single menu json array |
| 174 | - if(self::$resultType === 'json') |
|
| 175 | - return json_encode(self::$menu); |
|
| 177 | + if(self::$resultType === 'json') { |
|
| 178 | + return json_encode(self::$menu); |
|
| 179 | + } |
|
| 176 | 180 | |
| 177 | 181 | // return single menu array |
| 178 | 182 | return self::$menu; |
@@ -184,8 +188,9 @@ discard block |
||
| 184 | 188 | */ |
| 185 | 189 | public static function checkGroupId($type) |
| 186 | 190 | { |
| 187 | - if($type !== null && isset(self::$type)) |
|
| 188 | - return true; |
|
| 191 | + if($type !== null && isset(self::$type)) { |
|
| 192 | + return true; |
|
| 193 | + } |
|
| 189 | 194 | |
| 190 | 195 | return false; |
| 191 | 196 | } |
@@ -201,8 +206,9 @@ discard block |
||
| 201 | 206 | |
| 202 | 207 | if(class_exists($obj)) { |
| 203 | 208 | $class = new $obj; |
| 204 | - if ($class->handle($route)) |
|
| 205 | - return true; |
|
| 209 | + if ($class->handle($route)) { |
|
| 210 | + return true; |
|
| 211 | + } |
|
| 206 | 212 | return false; |
| 207 | 213 | } |
| 208 | 214 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | self::$routes[self::$currentRoute] = []; |
| 84 | 84 | |
| 85 | 85 | // make menu array |
| 86 | - $array = self::add($route,$callback); |
|
| 86 | + $array = self::add($route, $callback); |
|
| 87 | 87 | |
| 88 | 88 | if (self::checkGroupId(self::$type)) |
| 89 | 89 | // add to the group render array |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | public static function addSub($route, $callback) |
| 122 | 122 | { |
| 123 | 123 | // register route name |
| 124 | - array_push(self::$routes[self::$currentRoute],$route); |
|
| 124 | + array_push(self::$routes[self::$currentRoute], $route); |
|
| 125 | 125 | |
| 126 | 126 | // return submenu array |
| 127 | - return self::add($route,$callback); |
|
| 127 | + return self::add($route, $callback); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param $callback |
| 136 | 136 | * @return array |
| 137 | 137 | */ |
| 138 | - private static function add($route,$callback) |
|
| 138 | + private static function add($route, $callback) |
|
| 139 | 139 | { |
| 140 | 140 | // instance of menu class |
| 141 | 141 | $menu = new Menu; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public static function routes() |
| 157 | 157 | { |
| 158 | 158 | // return json array of all routes-name |
| 159 | - if(self::$resultType === 'json') |
|
| 159 | + if (self::$resultType === 'json') |
|
| 160 | 160 | return json_encode(self::$routes); |
| 161 | 161 | |
| 162 | 162 | // return array of all routes-name |
@@ -184,11 +184,11 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public static function render($type = null) |
| 186 | 186 | { |
| 187 | - if(self::checkGroupId($type)) |
|
| 187 | + if (self::checkGroupId($type)) |
|
| 188 | 188 | { |
| 189 | 189 | |
| 190 | 190 | // render the menu json array |
| 191 | - if(self::$resultType === 'json') |
|
| 191 | + if (self::$resultType === 'json') |
|
| 192 | 192 | return json_encode(self::$menu[$type]); |
| 193 | 193 | |
| 194 | 194 | // render the menu array |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | // return single menu json array |
| 199 | - if(self::$resultType === 'json') |
|
| 199 | + if (self::$resultType === 'json') |
|
| 200 | 200 | return json_encode(self::$menu); |
| 201 | 201 | |
| 202 | 202 | // return single menu array |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public static function checkGroupId($type) |
| 213 | 213 | { |
| 214 | - if($type !== null && isset(self::$type)) |
|
| 214 | + if ($type !== null && isset(self::$type)) |
|
| 215 | 215 | return true; |
| 216 | 216 | |
| 217 | 217 | return false; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | { |
| 229 | 229 | $obj = self::$checkStatusObject; |
| 230 | 230 | |
| 231 | - if(class_exists($obj)) |
|
| 231 | + if (class_exists($obj)) |
|
| 232 | 232 | { |
| 233 | 233 | $class = new $obj; |
| 234 | 234 | if ($class->handle($route)) |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public static function hasSub($menu) |
| 23 | 23 | { |
| 24 | 24 | // check menu has sub |
| 25 | - if(! empty($menu['sub'])) |
|
| 25 | + if (!empty($menu['sub'])) |
|
| 26 | 26 | return true; |
| 27 | 27 | |
| 28 | 28 | return false; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $tag = $value['tag']; |
| 42 | 42 | |
| 43 | - if($value['tag'] === null) |
|
| 43 | + if ($value['tag'] === null) |
|
| 44 | 44 | $tag = 'i'; |
| 45 | 45 | |
| 46 | 46 | return '<' . $tag . ' class="' . $value['value'] . '"></' . $tag . '>'; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public static function new_tab($newTab) |
| 57 | 57 | { |
| 58 | - if($newTab) |
|
| 58 | + if ($newTab) |
|
| 59 | 59 | return 'target="_blank"'; |
| 60 | 60 | |
| 61 | 61 | return null; |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | * @return bool |
| 16 | 16 | */ |
| 17 | 17 | function hasSub($menu){ |
| 18 | - if(! empty($menu['sub'])) |
|
| 19 | - return true; |
|
| 18 | + if(! empty($menu['sub'])) { |
|
| 19 | + return true; |
|
| 20 | + } |
|
| 20 | 21 | return false; |
| 21 | 22 | } |
| 22 | 23 | } |
@@ -31,8 +32,9 @@ discard block |
||
| 31 | 32 | |
| 32 | 33 | $tag = $value['tag']; |
| 33 | 34 | |
| 34 | - if($value['tag'] === null) |
|
| 35 | - $tag = 'i'; |
|
| 35 | + if($value['tag'] === null) { |
|
| 36 | + $tag = 'i'; |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | 39 | return '<' . $tag . ' class="' . $value['value'] . '"></' . $tag . '>'; |
| 38 | 40 | } |
@@ -45,8 +47,9 @@ discard block |
||
| 45 | 47 | * @return null|string |
| 46 | 48 | */ |
| 47 | 49 | function new_tab($newTab){ |
| 48 | - if($newTab) |
|
| 49 | - return 'target="_blank"'; |
|
| 50 | + if($newTab) { |
|
| 51 | + return 'target="_blank"'; |
|
| 52 | + } |
|
| 50 | 53 | |
| 51 | 54 | return null; |
| 52 | 55 | } |