src/UI/MenuSet.php
public static function import($json_str)
    {
        try {
            $json = json_decode($json_str); 
            // print_r($json);
            $retval = new MenuSet();
            $retval->home = new \Tsugi\UI\MenuEntry($json->home->link, $json->home->href);
            if ( isset($json->left) ) $retval->left = self::importRecurse($json->left, 0);
            if ( isset($json->right) ) $retval->right = self::importRecurse($json->right, 0);
            return $retval;
        } catch (Exception $e) {
            return false;
        }
    }
public static function import($json_str)
    {
        try {
            $json = json_decode($json_str); 
            // print_r($json);
            $retval = new MenuSet();
            $retval->home = new \Tsugi\UI\MenuEntry($json->home->link, $json->home->href);
            if ( isset($json->left) ) $retval->left = self::importRecurse($json->left, 0);
            if ( isset($json->right) ) $retval->right = self::importRecurse($json->right, 0);
            return $retval;
        } catch (Exception $e) {
            return false;
        }
    }
public static function import ( $ json_str ) { try { $ json = json_decode ( $ json_str ) ; // print_r($json); $ retval = new MenuSet ( ) ; $ retval -> home = new \ Tsugi \ UI \ MenuEntry ( $ json -> home -> link , $ json -> home -> href ) ; if ( isset ( $ json -> left ) ) $ retval -> left = self :: importRecurse ( $ json -> left , 0 ) ; if ( isset ( $ json -> right ) ) $ retval -> right = self :: importRecurse ( $ json -> right , 0 ) ; return $ retval ; } catch ( Exception $ e ) { return false ; } }
Import a menu from JSON

@param $json_str The menu as exported

@return The MenuSet as parsed or false on error
Import a menu from JSON