Parse the name and format according to the root namespace.

@param  string  $name
@return string
978721
protected function parseName($name)
    {
        $rootNamespace = $this->getLaravelRootNamespace();

        if (Str::startsWith($name, $rootNamespace)) {

            return $name;
        }

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

        return $this->parseName($this->getDefaultNamespace(trim($rootNamespace, '\\')) . '\\' . $name);
    }
1126095
public static function formatName($name)
    {
        /* Split name and version */
        $parts = [];
        if (preg_match('/([^[0-9]*)([0-9]*)/', $name, $parts) === false) {
            return $name;
        }

        /* Format name */
        $base = $parts[1];
        switch ($base) {
            case 'MySql':
                $base = 'MySQL';
                break;
            case 'MariaDb':
                $base = 'MariaDB';
                break;
        }

        /* Parse version to array */
        $ver_str = $parts[2];
        if (strlen($ver_str) % 2 === 1) {
            $ver_str = '0' . $ver_str;
        }
        $version = array_map('intval', str_split($ver_str, 2));
        /* Remove trailing zero */
        if ($version[count($version) - 1] === 0) {
            $version = array_slice($version, 0, count($version) - 1);
        }
        /* Create name */
        return $base . ' ' . implode('.', $version);
    }
381144
protected function qualifyClass($name)
    {
        $rootNamespace = $this->rootNamespace();

        if (Str::startsWith($name, $rootNamespace . '\\')) {
            return $name;
        }

        $name = str_replace('/', '\\', $name);

        return $this->qualifyClass(
            $this->getDefaultNamespace(trim($rootNamespace, '\\')) . '\\' . $name
        );
    }
1028564
protected function parseNamespaceSegments(string $name): array
    {
        $segments = explode(static::NAMESPACE_DELIMITER, $name);
        if (count($segments) !== 2) {
            throw new \InvalidArgumentException("Template [{$name}] has an invalid name.");
        }
        if (! isset($this->paths[$segments[0]])) {
            throw new \InvalidArgumentException("No namespace defined for [{$segments[0]}].");
        }

        return $segments;
    }
1192682
public static function format($name)
    {
        if (false !== ($pos = strrpos($name, '__'))) {
            $name = substr($name, 0, $pos);
        }

        return $name;
    }
1009649
protected function parseName($name)
    {
        if (Str::contains($name, '/')) {
            $name = str_replace('/', '\\', $name);
        }

        $names = array_slice(explode('\\', $name), -1, 1);

        return count($names) ? $names[0] : $name;
    }
931594
private function extractAllNamespaces($name)
    {
        // -1 as third argument is needed to skip the command short name when exploding
        $parts = explode(':', $name, -1);
        $namespaces = array();

        foreach ($parts as $part) {
            if (count($namespaces)) {
                $namespaces[] = end($namespaces).':'.$part;
            } else {
                $namespaces[] = $part;
            }
        }

        return $namespaces;
    }
849069
protected function parseConnectionName($name)
    {
        $name = $name ?: $this->getDefaultConnection();

        return Str::endsWith($name, ['::read', '::write'])
                            ? explode('::', $name, 2) : [$name, null];
    }
488232
protected function getName($name)
    {
        $name = parent::getName($name);

        // This fixes any URL encoded filename and sanitize it
        $name = strtolower(urldecode($name));

        // Replace spaces with a dash
        $name = preg_replace('!\s+!', '-', $name);

        // Remove odd characters
        return preg_replace('/[^A-Za-z0-9\-_\.]/', '', $name);
    }
759258
protected function normalizeName($name)
    {
        $extension = '.' . $this->app['twig.extension'];
        $length = strlen($extension);

        if (substr($name, -$length, $length) === $extension) {
            $name = substr($name, 0, -$length);
        }

        // Normalize namespace and delimiters
        $delimiter = ViewFinderInterface::HINT_PATH_DELIMITER;
        if (strpos($name, $delimiter) === false) {
            return str_replace('/', '.', $name);
        }

        list($namespace, $name) = explode($delimiter, $name);

        return $namespace.$delimiter.str_replace('/', '.', $name);
    }
1296913
protected function parseExtend($name)
    {
        $this->setExtendedClass(null);

        $nameParts = explode('@extend', $name);
        $name = trim($nameParts[0]);
        if (count($nameParts) > 1) {
            $this->setExtendedClass($nameParts[1]);
        }

        return $name;
    }
557523
protected function normalizeName(string $name) : string
    {
        $name = parent::normalizeName($name);

        if (strpos($name, 'http-') === 0) {
            $name = substr($name, 5);
        }

        return $name;
    }
990688
public static function normalizeName($name)
    {
        if (false !== ($pos = strrpos($name, '.'))) {
            $name = substr($name, $pos + 1);
        }

        return $name;
    }
550548
public function getNameSpace(string $name) : string
    {
        $segs = [];
        $name = str_replace("/", "\\", $name);
        $namespace = explode("\\", $name);
        array_pop($namespace);

        array_walk($namespace, function (&$value) {
            $value = $this->removeNoneAlpherNumeric($value);
        });

        return implode("\\", $namespace);
    }
1002082
public function normalizeDefinitionName(string $name): string
    {
        $elements = explode('/', $name);

        return $elements[count($elements) - 1];
    }
950406
public function get_namespace($name = null)
    {
        $ns = $this->namespace;

        if ($name) {
            // an alias for BC
            if ($name == 'prefix') {
                $name = 'prefix_in';
            }

            return isset($ns[$name]) ? $ns[$name] : null;
        }

        unset($ns['prefix_in'], $ns['prefix_out']);

        return $ns;
    }
561566
public function getFullName($name)
    {
        $prefix = $this->getPrefix();
        if (strlen($prefix) && false === strpos($name, $prefix)) {
            return $prefix . $name;
        }

        return $name;
    }