Timber\Menu::__construct PHP Метод

__construct() публичный Метод

public __construct ( integer | string $slug )
$slug integer | string
    public function __construct($slug = 0)
    {
        $menu_id = false;
        $locations = get_nav_menu_locations();
        if ($slug != 0 && is_numeric($slug)) {
            $menu_id = $slug;
        } else {
            if (is_array($locations) && count($locations)) {
                $menu_id = $this->get_menu_id_from_locations($slug, $locations);
            } else {
                if ($slug === false) {
                    $menu_id = false;
                }
            }
        }
        if (!$menu_id) {
            $menu_id = $this->get_menu_id_from_terms($slug);
        }
        if ($menu_id) {
            $this->init($menu_id);
        } else {
            $this->init_as_page_menu();
        }
    }