Lavary\Menu\Item::__construct PHP Method

__construct() public method

Creates a new Lavary\Menu\MenuItem instance.
public __construct ( Menu $builder, $id, string $title, $options ) : void
$builder Menu
$title string
return void
    public function __construct($builder, $id, $title, $options)
    {
        $this->builder = $builder;
        $this->id = $id;
        $this->title = $title;
        $this->nickname = isset($options['nickname']) ? $options['nickname'] : camel_case(Str::ascii($title));
        $this->attributes = $this->builder->extractAttributes($options);
        $this->parent = is_array($options) && isset($options['parent']) ? $options['parent'] : null;
        // Storing path options with each link instance.
        if (!is_array($options)) {
            $path = array('url' => $options);
        } elseif (isset($options['raw']) && $options['raw'] == true) {
            $path = null;
        } else {
            $path = array_only($options, array('url', 'route', 'action', 'secure'));
        }
        if (!is_null($path)) {
            $path['prefix'] = $this->builder->getLastGroupPrefix();
        }
        $this->link = $path ? new Link($path) : null;
        // Activate the item if items's url matches the request uri
        if (true === $this->builder->conf('auto_activate')) {
            $this->checkActivationStatus();
        }
    }