Set name

@throws \InvalidArgumentException if the name is empty
@param string $name Capability name
@return \RolesCapabilities\Capability
490
public function setName(string $name): \RolesCapabilities\Capability
    {
        if (empty($name)) {
            throw new InvalidArgumentException("Name cannot be empty");
        }
        $this->name = $name;

        return $this;
    }
384861
protected function setUsername($name) {
        if (!is_string($name)) throw new IllegalTypeException('Illegal type of parameter $name: '.gettype($name));
        if (!strlen($name))    throw new InvalidArgumentException('Invalid parameter $name: "'.$name.'" (empty)');

        $this->username = $name;
        return $this;
    }
696999
public function setName($name)
    {
        $name = Str::cast($name);

        $this->name = $name->lower();

        return $this;
    }
483965
public function setName($name)
    {
        if (is_scalar($name) || method_exists($name, '__toString')) {
            $this->name = (string) $name;
        } else {
            throw new InvalidArgumentException('The name must be a string.');
        }

        if ($this->name === '') {
            $this->name = 'Error';
        }

        return $this;
    }
1057523
public function getOption($name) {
        if(!isset($this->options[$name])){
            throw new InvalidArgumentException(sprintf("The option name '%s' is invalid, available are %s.",$name, implode(",",array_keys($this->options))));
        }
        return $this->options[$name];
    }
208234
public static function createFromName($name)
    {
        $value = array_search($name, static::$names, true);

        if (!$value) {
            throw new InvalidArgumentException(sprintf(
                'Level with name "%s" is not in list: %s',
                $name,
                implode(', ', static::$names)
            ));
        }

        return new static($value);
    }
879887
public function setName($name)
    {
        if (strpos(self::PATH_SEPARATOR, $name) !== false) {
            throw new \InvalidArgumentException(
                'Invalid character "' . self::PATH_SEPARATOR . '" in resource name.'
            );
        }

        $this->name = $name;
    }
1203912
final public function setName($name): Command
    {
        if (!$this->namespace) {
            parent::setName($name);
            return $this;
        }
        parent::setName(sprintf('%s:%s', $this->namespace, $name));
        return $this;
    }
632427
public function setName($name)
    {
        if (!empty($name) && ctype_print($name)) {
            $this->name = trim($name);
        }

        return $this;
    }
819399
public function setName(string $name): self
    {
        if (empty($name)) {
            throw new \InvalidArgumentException("Group name can not be empty");
        }
        $this->name = $name;
        return $this;
    }
624037
public function setName($name)
    {
        $name = strtolower($name);

        //Check for everything except letters and dashes.  Throw exception if any are found.
        if (preg_match("/[^a-z\-0-9\.]/", $name)) {
            throw new InvalidArgumentException(
                'Page names can only contain letters, numbers, dots, and dashes.'
                . ' No spaces. This page name is invalid: ' . $name
            );
        }

        $this->name = $name;
    }
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;
	}
1002769
public function setName($name) {
    if (is_string($name)) {
      $name = Token::identifier($name);
    }
    $this->name->replaceWith($name);
    return $this;
  }
428855
public function setName($name)
    {
        $this->name = $name;
        $this->setChecked($this->form->getFieldValue($this->name) == $this->getValue());
        return $this;
    }
1237098
public function setName(string $name): self
    {
        @trigger_error('Using Type::setName() is deprecated. Please use name property directly.', E_USER_DEPRECATED);

        $this->name = $name;
        $this->metadata = null;

        return $this;
    }
719184
public function setName($name, $isEmpty = NULL)
	{
		if ($name !== NULL && !is_string($name)) {
			throw new InvalidArgumentException(sprintf('Name must be string or NULL, %s given.', gettype($name)));
		}

		$this->name = $name;
		$this->isEmpty = $isEmpty === NULL ? isset(static::$emptyElements[$name]) : (bool)$isEmpty;

		return $this;
	}
1167060
public function setName($name)
  {
    $allowedValues = $this->getNameAllowableValues();
    if (!is_null($name) && !in_array($name, $allowedValues)) {
      throw new \InvalidArgumentException(
        sprintf(
          "Invalid value for 'name', must be one of '%s'",
          implode("', '", $allowedValues)
        )
      );
    }
    $this->container['name'] = $name;

    return $this;
  }