Validates if class name have spaces between words.

@param string $name

@return string
768041
public function validateSpaces($name)
    {
        $string = $this->removeSpaces($name);
        if ($string == $name) {
            return $name;
        } else {
            throw new \InvalidArgumentException(
                sprintf(
                    'The name "%s" is invalid, spaces between words are not allowed.',
                    $name
                )
            );
        }
    }
1129243
public static function extractShortNameFromFullyQualifiedName($name)
    {
        if (($pos = strrpos($name, '\\')) !== false) {
            return substr($name, $pos + 1);
        } else {
            return $name;
        }
    }
108566
public static function validateCommandName($name)
    {
        $name = trim($name);

        if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
            throw new \InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
        }

        return $name;
    }
1252167
public static function fullyQualifiedDomainName(string $name): bool
    {
        $isValid = strlen($name) < 254;
        $isValid &= 1 === preg_match('/^(?:(?!-)[a-z0-9\-]{1,63}(?<!-)\.){1,127}$/i', $name);

        return $isValid;
    }
118969
private static function validateName(string $name) : string
  {
    if (empty($name) || preg_match("/[=,; \t\r\n\013\014]/", $name)) {
      throw new \InvalidArgumentException(sprintf('Invalid name \'%s\'.', $name));
    }

    return $name;
  }
155611
private function getClassNameCandidates(array $namespaces, $name)
    {
        $className = str_replace(' ', '', ucwords($name));

        return array_map(function ($namespace) use ($className) { return $namespace.$className; }, $namespaces);
    }
588329
protected function validateFileName($name)
    {
        if (!preg_match('/^[\w@\.\s_\-]+$/iu', $name)) {
            return false;
        }

        if (strpos($name, '..') !== false) {
            return false;
        }

        return true;
    }
1074512
public static function deNamespace($className)
        {
            $className = trim($className, '\\');

            if ($lastSeparator = strrpos($className, '\\')) {
                $className = substr($className, $lastSeparator + 1);
            }

            return $className;
        }
1065177
private function getFormattedErrors($name)
    {
        if (!$this->hasErrors($name)) {
            return '';
        }

        $errors = $this->session->get('errors');

        return $errors->first($this->transformKey($name), '<div class="invalid-feedback">:message</div>');
    }
505634
protected function validateName($name)
    {
        if (!ApiKey::isValidName($name)) {
            return self::MESSAGE_ERROR_INVALID_NAME;
        }
        if (!ApiKey::nameExists($name)) {
            return self::MESSAGE_ERROR_NAME_DOES_NOT_EXIST;
        }
        return null;
    }
989197
protected function getClassname($name)
    {
        $result = implode(' ', explode('/', $name));
        $result = implode(' ', explode('-', $result));

        $result = ucwords($result);

        // replace non letter or digits by empty string
        $result = preg_replace('/[^\\pL\d]+/u', '', $result);

        // trim
        $result = trim($result, '-');

        // transliterate
        $result = iconv('UTF-8', 'US-ASCII//TRANSLIT', $result);

        // remove unwanted characters
        $result = preg_replace('/[^-\w]+/', '', $result);

        return $result;
    }
1226280
private static function extractWords($name) {
        /** @noinspection ReturnFalseInspection */
        if (false === strpos($name, '_')) {
            $r = preg_replace('#[A-Z]#', ' $0', $name);
        } else {
            $r = strtr($name, array('_' => ' '));
        }
        $r = strtolower(ltrim($r));
        return $r;
    }
1106675
protected function cleanFileName($name)
    {
        $title = Str::ascii($name);

        // Convert all dashes/underscores into separator
        $flip = $separator = '-';
        $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title);

        // Remove all characters that are not the separator, letters, numbers, whitespace or @.
        $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s@]+!u', '', mb_strtolower($title));

        // Replace all separator characters and whitespace by a single separator
        $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title);

        return trim($title, $separator);
    }
107690
private function getFormattedErrors($name)
    {
        if (!$this->hasErrors($name)) {
            return '';
        }
        // Get errors session
        $errors = $this->getErrorsSession();

        return $errors->first($this->transformKey($name), '<p class="help-block">:message</p>');
    }
1040522
public static function toNameStrict( string $name )
	{
		$len = strlen($name);
		if( $len < 1 || $len > 50 )
		{
			return false;
		}

		$name = str_replace("-", "_", $name);
		if(strpos($name, "__") !== false || $name[0] === "_" || $len > 1 && $name[$len-1] === "_")
		{
			return false;
		}

		if( strpos($name, "_") !== false || ! ctype_upper($name[0]) )
		{
			$name = self::toName($name);
		}

		if( is_numeric($name[0]) || preg_match('/[^a-zA-Z0-9]/', $name ) )
		{
			return false;
		}

		return $name;
	}
777386
static function formatClassName ($name)
  {
    $n = explode ('\\', $name);
    $c = array_pop ($n);
    return sprintf ("<span class='__type hint--rounded hint--top' data-hint='%s'>%s</span>", $name, $c);
  }
1184414
private function getSafeName(string $name) : string
    {
        $name = preg_replace('/[^A-Za-z0-9-]/', '_', $name);
        if (strlen($name) > 64) {
            if (str_word_count($name) > 1 && preg_match_all('/\b(\w)/', $name, $m)) {
                // Create an "acronym" from first letters
                $short = implode('', $m[1]);
            } else {
                $short = md5($name);
            }
            $short .= "_";
            $remaining = 64 - strlen($short);
            $nextSpace = strpos($name, " ", (strlen($name)-$remaining))
                ? : strpos($name, "_", (strlen($name)-$remaining));

            $newName = $nextSpace === false
                ? $short
                : $short . substr($name, $nextSpace);
        } else {
            $newName = $name;
        }

        $newName = preg_replace('/[^A-Za-z0-9-]+/', '_', $newName);
        $newName = trim($newName, "_");
        return $newName;
    }