Retrieves a menu by its name

@param string $name
@param array $options
@return \Knp\Menu\ItemInterface
@throws \InvalidArgumentException if the menu does not exists
556448
public function get($name, array $options = array())
    {
        return $this->builder->build($name, $this->container->get('request_stack')->getCurrentRequest());
    }
740412
public function get($name)
    {
        if (!array_key_exists($name, $this->queues)) {
            throw new \InvalidArgumentException("The queue does not exist. {$name}");
        }

        return $this->queues[$name];
    }
1146961
public function plugin(string $name, array $options = []): PluginInterface
    {
        return $this->getPluginManager()->get($name, $options);
    }
6571
public function getMenu($name)
    {
        try {
            $menu = app('TypiCMS.menus')->first(function (Menu $menu) use ($name) {
                return $menu->name == $name;
            });
        } catch (Exception $e) {
            Log::info('No menu found with name “'.$name.'”');

            return;
        }

        return $menu;
    }
1267070
protected function getOptionsList($name, $options)
    {
        if (empty($options)) {
            $options = $this->getOptionsFromModel($name);
        }

        return $options;
    }
279480
public function getCheckbox($name, array $options=[]) {
		$choices = $this->getChoices();
		$default = $this->value;

		$value = isset($options['value']) ? $options['value']:null;
		if($value===null) {
			foreach($choices as $k=>$v) {
				if($v == $name) {
					$value = $k;
					break;
				}
			}
		}
		if($value === null)
			throw new \Exception('No value for checkbox '.$name);

		if(in_array($value, $default))
			$options['attrs']['checked'] = 'checked';
		$options['label'] = $name;

		return $this->getTopForm()->getWidget('checkbox', $this->name.'[]', $value, $options);
	}
434970
public function getMenu(string $name, ?string $uniqueKey = null, ...$args): MenuItemInterface
    {
        if ($uniqueKey && $args) {
            return $this->container->getMenuWithArgs($name, $uniqueKey, ...$args);
        }

        return $this->container->getMenu($name);
    }
916491
public function button($name, array $options = []) {
        $options += [
            'type' => 'button'
        ];
        $options = $this->addClass($options, 'navbar-btn');
        return $this->Form->button($name, $options);
    }
950579
public function get($name)
    {
        if (!isset($this->menus[$name])) {
            throw new \InvalidArgumentException(sprintf('The menu "%s" is not defined.', $name));
        }

        if (!is_array($this->menus[$name]) || 2 !== count($this->menus[$name])) {
            throw new \InvalidArgumentException(sprintf('The service definition for menu "%s" is invalid. It should be an array (serviceId, method)', $name));
        }

        if (!array_key_exists($name, $this->cachedMenus)) {
            list($id, $method) = $this->menus[$name];
            $this->cachedMenus[$name] = $this->container->get($id)->$method($this->builder);
        }
        return $this->cachedMenus[$name];
    }
193014
public final function getOption($name)
    {
        return isset($this->_options[$name]) ? $this->_options[$name] : null;
    }
1306386
public function make($name, array $options)
    {
        //check the permission on this item
        $options = $this->parseDefaults($name, $options);

        //now we can instantiate the object
        return $this->getActionObject($options);
    }
816906
public function menu($name)
    {
        if (array_key_exists($name, $this->menus)) {
            return $this->menus[$name];
        }

        return $this->menus[$name] = new MenuBuilder($name, $this->config);
    }
707641
public static function create(string $name, array $options = [])
    {
        $menu = new Menu($name, new MenuConfiguration($options));

        if (array_key_exists('share', $options)) {
            if (is_bool($options['share'])) { // we should also handle if 'share' => false is passed
                if (true === $options['share']) { // but only actually share if true
                    View::share($menu->name, $menu);
                }
            } else {
                View::share((string)$options['share'], $menu);
            }
        }

        return $menu;
    }
119258
public function getMenu(string $name): Menu
    {
        if (!$this->hasMenu($name)) {
            throw new Exception('Invalid menu name "'.$name.'"');
        }

        return $this->menus[$name];
    }
798243
public static function getOptions(string $name): array
    {
        if (isset(self::$options) && is_array(self::$options))
            return self::$options[$name];
        return [];
    }
1157710
public function rename($name, array $options = [])
    {
        $driveLocator = "/drives/{$this->parentReference->driveId}";
        $itemLocator  = "/items/{$this->id}";
        $endpoint     = "$driveLocator$itemLocator";

        $body = [
            'name' => (string) $name,
        ];

        $response = $this
            ->graph
            ->createRequest('PATCH', $endpoint)
            ->attachBody($body + $options)
            ->execute();

        $status = $response->getStatus();

        if ($status != 200) {
            throw new \Exception("Unexpected status code produced by 'PATCH $endpoint': $status");
        }

        $driveItem = $response->getResponseAsObject(DriveItem::class);

        return new self($this->graph, $driveItem);
    }
383159
public function get($name, array $options = array())
    {
        $name = strtolower((string) $name);

        if (!$this->has($name)) {
            throw new InvalidArgumentException(sprintf('Unrecognized compressor "%s"', $name));
        }

        $mapping = $this->getMapping();
        $className = $mapping[$name];

        if ($options === array()) {
            return new $className();
        }

        $reflection = new \ReflectionClass($className);
        return $reflection->newInstanceArgs($options);
    }