public function isActive($menuItem)
    {
        // If the `is_active` option is a callable object, return the result of this callable object with the current
        // item passed as the only argument
        if (is_callable(array_get($menuItem, 'is_active'))) {
            return (bool)call_user_func($menuItem['is_active'], $menuItem);
        }

        // If the `url_def` option is defined, use the `hieu-le/active` helper functions to calculate the result from
        // the keys and values of this array.
        if ($urlDef = array_get($menuItem, 'url_def')) {
            $result = true;
            foreach ($urlDef as $method => $value) {
                if (!is_array($value)) {
                    $result = $result && call_user_func("if_" . $method, [$value]);
                } else {
                    foreach ($value as $k => $v) {
                        $result = $result && call_user_func("if_" . $method, $k, $v);
                    }
                }
            }

            return $result;
        }

        // Default: not active
        return false;
    }
public function isActive($menuItem)
    {
        // If the `is_active` option is a callable object, return the result of this callable object with the current
        // item passed as the only argument
        if (is_callable(array_get($menuItem, 'is_active'))) {
            return (bool)call_user_func($menuItem['is_active'], $menuItem);
        }

        // If the `url_def` option is defined, use the `hieu-le/active` helper functions to calculate the result from
        // the keys and values of this array.
        if ($urlDef = array_get($menuItem, 'url_def')) {
            $result = true;
            foreach ($urlDef as $method => $value) {
                if (!is_array($value)) {
                    $result = $result && call_user_func("if_" . $method, [$value]);
                } else {
                    foreach ($value as $k => $v) {
                        $result = $result && call_user_func("if_" . $method, $k, $v);
                    }
                }
            }

            return $result;
        }

        // Default: not active
        return false;
    }
public function isActive ( $ menuItem ) { // If the `is_active` option is a callable object, return the result of this callable object with the current // item passed as the only argument if ( is_callable ( array_get ( $ menuItem , 'is_active' ) ) ) { return ( bool ) call_user_func ( $ menuItem [ 'is_active' ] , $ menuItem ) ; } // If the `url_def` option is defined, use the `hieu-le/active` helper functions to calculate the result from // the keys and values of this array. if ( $ urlDef = array_get ( $ menuItem , 'url_def' ) ) { $ result = true ; foreach ( $ urlDef as $ method => $ value ) { if ( ! is_array ( $ value ) ) { $ result = $ result && call_user_func ( "if_" . $ method , [ $ value ] ) ; } else { foreach ( $ value as $ k => $ v ) { $ result = $ result && call_user_func ( "if_" . $ method , $ k , $ v ) ; } } } return $ result ; } // Default: not active return false ; }
Check if a menu item is currently active or not

@param $menuItem

@return bool
Check if a menu item is currently active or not