Get or set the name.

@param string $name
@return MenuItem|string
430830
public function name($name = null)
    {
        if ($name === null) {
            return $name;
        }
        $this->_name = $name;

        return $this;
    }
1057942
public function get($name, array $options = [])
    {
        if (null === $menu = $this->findByName($name)) {
            throw new \InvalidArgumentException(sprintf('The menu "%s" is not defined.', $name));
        }

        return $this->buildItem($menu, array_merge([
            'attributes' => ['id' => $menu['name'] . '-nav'] // Root css id
        ], $options));
    }
290037
public function setName($name)
    {
        // Set name in payload
        $payload = $this->getPayload();
        $payload['name'] = $name;

        return $this->setPayload($payload);
    }
688013
public function findByName($name)
    {
        $this->loadMenus();

        $rootId = 0;
        if (0 < strpos($name, ':')) {
            list($rootName, $name) = explode(':', $name);
            if (null === $root = $this->findByName($rootName)) {
                throw new \InvalidArgumentException(sprintf('Root menu "%s" not found.', $rootName));
            }
            $rootId = intval($root['id']);
        }

        foreach ($this->menus as $menu) {
            if ($menu['name'] === $name && !(0 < $rootId && intval($menu['root']) != $rootId)) {
                return $menu;
            }
        }

        return null;
    }
734389
public function getItems($name = '')
    {
        if (empty($name)) {
            return $this->items;
        }

        if (! isset($this->items[$name])) {
            return false;
        }

        return $this->items[$name];
    }
1233969
public function setName($name) {
    /** @var TokenNode $identifier */
    $identifier = $this->name->firstChild();
    $identifier->setText($name);
    return $this;
  }
1002769
public function setName($name) {
    if (is_string($name)) {
      $name = Token::identifier($name);
    }
    $this->name->replaceWith($name);
    return $this;
  }
930379
public function setName(string $name) : core\interfaces\Named
    {
        return parent::setName(ltrim($name, '-'));
    }
1137892
public function setName($name) {
		if (is_array($name) && empty($name)) {
			$this->name = new \stdClass;
		} else {
			$this->name = $name;
		}

		return $this;
	}
1225002
public function setName(string $name): string
    {
        $this->current->setName($this->prefix . $name);

        return $this->getName();
    }
18116
public function get( $name )
	{
		if ($this->offsetExists($name))
		{
			return $this->items[$name];
		}
		return $this->itemsGetUndefined;
	}
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);
    }
1355347
public function getItem($name)
    {
        if (func_num_args() > 1)
            $name = func_get_args();

        $info  = $this->getItemData($name);
        $class = $info['class'];

        return new $class();
    }
1169954
protected function get_namefor($name = '') {
        $name = $name !== '' ? '_' . $name : '';
        return $this->subplugintype . '_' . $this->subpluginname . $name;
    }
311194
public function removeName(Name $name)
    {
        if ($this->names->contains($name)) {
            $this->names->removeElement($name);
            $name->setItem(null);
        }

        return $this;
    }
835303
public function setName($name)
	{
		// Check if we need to make this an array
		$endsWithBrackets = substr_compare($name, '[]', -2, 2) === 0;
		if ($this->isAutoArray() && ! $endsWithBrackets)
		{
			$name .= '[]';
		}

		$this->itSetName($name);

		// For any children, update the name
		foreach ($this->getContents() as $item)
		{
			$item->setName($this->getName());
		}

		return $this;
	}
671875
public function getRouteName($name)
    {
        $sectionPrefix = $this->getSection() ? $this->getSection() . '_' : '';

        return sprintf('%s_%s%s_%s', $this->metadata->getApplicationName(), $sectionPrefix, $this->metadata->getName(), $name);
    }