@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | public function sub($route, $callback) |
| 54 | 54 | { |
| 55 | 55 | $sub = SideNav::addSub($route, $callback); |
| 56 | - array_push($this->submenu,$sub); |
|
| 56 | + array_push($this->submenu, $sub); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function subWithCheckStatus($route, $callback) |
| 65 | 65 | { |
| 66 | - if(SideNav::checkStatus($route) === true){ |
|
| 66 | + if (SideNav::checkStatus($route) === true) { |
|
| 67 | 67 | $sub = SideNav::addSub($route, $callback); |
| 68 | - array_push($this->submenu,$sub); |
|
| 68 | + array_push($this->submenu, $sub); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $submenu = null; |
| 176 | 176 | |
| 177 | - if(!empty($this->submenu)) |
|
| 177 | + if (!empty($this->submenu)) |
|
| 178 | 178 | $submenu = $this->submenu; |
| 179 | 179 | |
| 180 | 180 | $result = [ |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | 'sub' => $submenu |
| 190 | 190 | ]; |
| 191 | 191 | |
| 192 | - if(empty($this->submenu)) |
|
| 192 | + if (empty($this->submenu)) |
|
| 193 | 193 | unset($result['sub']); |
| 194 | 194 | |
| 195 | 195 | return $result; |
@@ -8,44 +8,44 @@ |
||
| 8 | 8 | * SideNav helper functions |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -if(! function_exists('hasSub')){ |
|
| 11 | +if (!function_exists('hasSub')) { |
|
| 12 | 12 | /** |
| 13 | 13 | * Check menu has sub |
| 14 | 14 | * @param $menu |
| 15 | 15 | * @return bool |
| 16 | 16 | */ |
| 17 | - function hasSub($menu){ |
|
| 18 | - if(! empty($menu['sub'])) |
|
| 17 | + function hasSub($menu) { |
|
| 18 | + if (!empty($menu['sub'])) |
|
| 19 | 19 | return true; |
| 20 | 20 | return false; |
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -if(! function_exists('icon')){ |
|
| 24 | +if (!function_exists('icon')) { |
|
| 25 | 25 | /** |
| 26 | 26 | * Print item icon |
| 27 | 27 | * @param $value |
| 28 | 28 | * @return string |
| 29 | 29 | */ |
| 30 | - function itemIcon($value){ |
|
| 30 | + function itemIcon($value) { |
|
| 31 | 31 | |
| 32 | 32 | $tag = $value['tag']; |
| 33 | 33 | |
| 34 | - if($value['tag'] === null) |
|
| 34 | + if ($value['tag'] === null) |
|
| 35 | 35 | $tag = 'i'; |
| 36 | 36 | |
| 37 | 37 | return '<' . $tag . ' class="' . $value['value'] . '"></' . $tag . '>'; |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -if(! function_exists('new_tab')){ |
|
| 41 | +if (!function_exists('new_tab')) { |
|
| 42 | 42 | /** |
| 43 | 43 | * Print item new_tab option |
| 44 | 44 | * @param $newTab |
| 45 | 45 | * @return null|string |
| 46 | 46 | */ |
| 47 | - function new_tab($newTab){ |
|
| 48 | - if($newTab) |
|
| 47 | + function new_tab($newTab) { |
|
| 48 | + if ($newTab) |
|
| 49 | 49 | return 'target="_blank"'; |
| 50 | 50 | |
| 51 | 51 | return null; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | self::$routes[self::$current_route] = []; |
| 78 | 78 | |
| 79 | 79 | // make menu array |
| 80 | - $array = self::add($route,$callback); |
|
| 80 | + $array = self::add($route, $callback); |
|
| 81 | 81 | |
| 82 | 82 | if (self::checkGroupId(self::$type)) |
| 83 | 83 | // add to the group render array |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | public static function addSub($route, $callback) |
| 111 | 111 | { |
| 112 | 112 | // register route name |
| 113 | - array_push(self::$routes[self::$current_route],$route); |
|
| 113 | + array_push(self::$routes[self::$current_route], $route); |
|
| 114 | 114 | |
| 115 | 115 | // return submenu array |
| 116 | - return self::add($route,$callback); |
|
| 116 | + return self::add($route, $callback); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param $callback |
| 123 | 123 | * @return array |
| 124 | 124 | */ |
| 125 | - private static function add($route,$callback) |
|
| 125 | + private static function add($route, $callback) |
|
| 126 | 126 | { |
| 127 | 127 | // instance of menu class |
| 128 | 128 | $menu = new Menu; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | public static function routes() |
| 142 | 142 | { |
| 143 | 143 | // return json array of all routes-name |
| 144 | - if(self::$resultType === 'json') |
|
| 144 | + if (self::$resultType === 'json') |
|
| 145 | 145 | return json_encode(self::$routes); |
| 146 | 146 | |
| 147 | 147 | // return array of all routes-name |
@@ -160,10 +160,10 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public static function render($type = null) |
| 162 | 162 | { |
| 163 | - if(self::checkGroupId($type)) { |
|
| 163 | + if (self::checkGroupId($type)) { |
|
| 164 | 164 | |
| 165 | 165 | // render the menu json array |
| 166 | - if(self::$resultType === 'json') |
|
| 166 | + if (self::$resultType === 'json') |
|
| 167 | 167 | return json_encode(self::$menu[$type]); |
| 168 | 168 | |
| 169 | 169 | // render the menu array |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // return single menu json array |
| 174 | - if(self::$resultType === 'json') |
|
| 174 | + if (self::$resultType === 'json') |
|
| 175 | 175 | return json_encode(self::$menu); |
| 176 | 176 | |
| 177 | 177 | // return single menu array |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public static function checkGroupId($type) |
| 186 | 186 | { |
| 187 | - if($type !== null && isset(self::$type)) |
|
| 187 | + if ($type !== null && isset(self::$type)) |
|
| 188 | 188 | return true; |
| 189 | 189 | |
| 190 | 190 | return false; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | { |
| 200 | 200 | $obj = self::$checkStatusObject; |
| 201 | 201 | |
| 202 | - if(class_exists($obj)) { |
|
| 202 | + if (class_exists($obj)) { |
|
| 203 | 203 | $class = new $obj; |
| 204 | 204 | if ($class->handle($route)) |
| 205 | 205 | return true; |