Check Name.

@param  string  $name

@throws Exceptions\InvalidTypeException
971081
private function checkCallbackName(&$name)
    {
        if ( ! is_string($name)) {
            $type = gettype($name);

            throw new Exceptions\InvalidTypeException(
                "The callback name value must be a string, $type given."
            );
        }

        $name = strtolower(trim($name));
    }
453511
public function getType($name)
    {
        if (class_exists($name) || interface_exists($name)) {
            if ($this->hasTypeForClass($name)) {
                $name = $this->getTypeForClass($name);
            }
        }

        if (!$this->hasType($name)) {
            throw new \UnexpectedValueException(sprintf('Does not exist a valid definition for "%s" type', $name));
        }

        return $this->types[$name];
    }
974163
protected function checkNameIsNotBlacklisted(string $name): void
    {
        if (Str::contains($name, $this->blacklisted)) {
            throw new InvalidArgumentException("Invalid character in driver name [{$name}].");
        }
    }
1219598
private function validateName($name) {
        if (!is_string($name))    throw new IllegalTypeException('Illegal type of parameter $name: '.gettype($name));
        if ($name != trim($name)) throw new InvalidArgumentException('Invalid parameter $name: "'.$name.'" (enclosing white space)');

        if (strlen($name) && !preg_match('/^[^\s:]+(:[^\s:]+)*$/', $name))
            throw new InvalidArgumentException('Invalid parameter $name: "'.$name.'" (not a command name)');
        return $this;
    }
416859
public function setName($name)
    {
        if (!is_string($name) || (strlen($name) <= 0)) {
            $explodedNamespace = explode('\\', get_class($this));
            $class = $explodedNamespace[count($explodedNamespace) - 1];
            $asset = strtolower(preg_replace('/(.)([A-Z])/', '\\1 \\2', $class));

            throw SchemaException::invalidAssetName($asset);
        }

        $this->name = $name;
    }
1303949
protected function checkRelationExistence($name)
    {
        $getter = 'get' . ucfirst($name);
        $class = get_class($this->owner);

        if (method_exists($this->owner, $getter)) {
            /** @var ActiveQuery $value */
            $value = $this->owner->$getter();

            if (!($value instanceof ActiveQueryInterface)) {
                throw new InvalidConfigException("Value of relation '$getter' not valid");
            }

            $this->models[$name]['multiple'] = $value->multiple;
        } else {
            throw new InvalidConfigException("Relation '$class::$getter' for attribute '$name' does not exists");
        }
    }
908964
public function validateName($name)
    {
        if (empty($name)) {
            $this->addError('name', 'Name cannot be empty');
            return false;
        }

        if (!is_string($name)) {
            $this->addError('name', 'Name must be a string');
            return false;
        }

        if (mb_strlen($name, 'UTF-8') > 255) {
            $this->addError('name', 'Name length has to be less or equal to 255');
            return false;
        }


        return true;
    }
449816
protected function validateExtensionBlock($name, $callable, $type)
    {
        if (!is_string($name)) {
            throw new InvalidArgumentException(
                sprintf(
                    "Name argument for %s must be a string",
                    $type
                )
            );
        } elseif (!is_callable($callable)) {
            throw new InvalidArgumentException(
                sprintf(
                    "Callable %s argument named '%s' is not callable",
                    $type,
                    $name
                )
            );
        }
    }
760379
protected function addCheck($name, $type, $args)
    {
        $func = $type.'Check';

        if (method_exists($this, $func)) {
            $type = strtolower(str_replace($type, '', $name));
            $this->$func($type, $name, $args);
        } else {
          throw new \InvalidArgumentException('Invalid check type: '.$type);
        }
    }
1067578
protected function validateContainerName($name)
    {
        if (empty($name)
            || (false !== strpos($name, '/'))
            || strlen($name) > CONTAINER_NAME_LIMIT) {
            throw new Exceptions\InvalidContainerName();
        }
    }
963953
protected function assertViewVariableName($name)
    {
        if (!is_string($name)) {
            $type = (is_object($name) ? get_class($name) . ' ' : '') . gettype($name);
            throw new \InvalidArgumentException("Expected name to be a string, not a $type");
        }

        if (!preg_match('/^[a-z]\w*$/i', $name)) {
            throw new \InvalidArgumentException("Invalid name '$name'");
        }
    }
1119993
private function checkDataSourceName($name, DataSourceInterface $datasource = null)
    {
        if (empty($name)) {
            throw new DataSourceException('Name of data source can\'t be empty.');
        }

        if (isset($this->datasources[$name]) && ($this->datasources[$name] !== $datasource)) {
            throw new DataSourceException('Name of data source must be unique.');
        }

        if (!preg_match('/^[\w\d]+$/', $name)) {
            throw new DataSourceException('Name of data source may contain only word characters and digits.');
        }
    }
730076
public function setName($name)
    {
        if (empty($name))
            throw new \Exception('Invalid characters in database name:'.$name);
        $this->name = $name;
        return $this;
    }
899138
protected function validateName($name)
    {
        if (!ApiKey::isValidName($name)) {
            return self::MESSAGE_ERROR_INVALID_NAME_FORMAT;
        }
        if (ApiKey::nameExists($name)) {
            return self::MESSAGE_ERROR_NAME_ALREADY_USED;
        }
        return null;
    }
1133824
public function getType($name)
    {
        $map = $this->getTypeMap();
        return isset($map[$name]) ? $map[$name] : NULL;
    }
1121958
public function setName($name)
    {
      if(!is_string($name) || strlen(trim($name)) == 0)
        throw new InvalidArgumentException(__METHOD__ . '; Invalid name, must be a non empty string');

      $this->name = $name;
    }
490353
public function getType($name)
    {
        if ($this->hasType($name)) {
            return $this->types[$name];
        } else {
            throw new \InvalidArgumentException(sprintf('Widget type "%s" not found.', $name));
        }
    }