getFormat

@param string $name

@throws \DomainException
@return  FormatInterface
348170
public function getFormat($name)
    {
        if (empty($this->formats[$name]) || !($this->formats[$name] instanceof FormatInterface)) {
            $class = sprintf('Windwalker\\Language\\Format\\%sFormat', $name);

            if (!class_exists($class)) {
                throw new \DomainException('Format ' . $name . ' not support. Class: ' . $class . ' not found');
            }

            $this->formats[$name] = new $class();
        }

        return $this->formats[$name];
    }
542332
protected static function arrayFormat(array $data, $name)
    {
        $format = "\t'$name' => [\n";

        if (count($data) > 0) {
            foreach ($data as $key => $value) {
                $format .= "\t\t'$key' => $value::class , \n";
            }
        } else {
            $format .= "\t\t//\n";
        }

        $format .= "\t],\n\n";

        return $format;
    }
1124901
protected function formatGatewayClassName($name)
    {
        if (class_exists($name)) {
            return $name;
        }

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

        return __NAMESPACE__."\\Gateways\\{$name}Gateway";
    }
394315
public function getRegexp($name = null)
    {
        if ($name === null) {
            return $this->regexps;
        }
        return isset($this->regexps[$name]) ? $this->regexps[$name] : '[^/]+';
    }
206367
public function getComponentIdentifier($name, $domain = null)
    {
        if(!isset($domain)) {
            $domain = $this->getComponentDomain($name);
        }

        if($domain) {
            $hash = 'com://'.$domain.'/'.$name;
        } else {
            $hash = 'com:'.$name;
        }

        return $hash;
    }
959954
public function getEnvironmentConfiguration(string $name): EnvironmentConfiguration
    {
        if (array_key_exists($name, $this->environmentConfigurations)) {
            return $this->environmentConfigurations[$name];
        }
        throw new DomainException('There is no environment configuration with name' . $name);
    }
374303
public function getHelper($name)
    {
        if (empty($this->helpers[$name])) {
            $class = $this->findHelper($name);

            if ($class === false) {
                throw new \DomainException(sprintf('Helper: %s not found.', $name));
            }

            $this->helpers[$name] = new $class($this);
        }

        return $this->helpers[$name];
    }
389149
protected function getNamedParameterRegex($name)
    {
        if (mb_substr($name, 0, 1) == ':') {
            $name = mb_substr($name, 1);
        }

        return $this->wrapRegex($this->notInsideQuotes('\:' . preg_quote($name), false));
    }
935626
protected function getKnownFormat(string $formatName)
    {
        $knownFormats = [
            "email" => "/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,}$/ix",
            "swiftCode" => "/^[A-Za-z]{6}[A-Za-z0-9]{2}[0-9A-Za-z]{0,3}$/",
            "uri" => "/^\w+:(\/\/)?[^\s]+$/",
            "url" => "/^((\w+:)?\/\/[^\s\/]+)?(\/[^\s]+)*\/?$/",
        ];

        if (array_key_exists($formatName, $knownFormats)) {
            return $knownFormats[$formatName];
        } else {
            return null;
        }
    }
370047
public function trans_format($name) {
        $name = trim($name);

        if ($name == 'moodle_auto_format') {
            return FORMAT_MOODLE;
        } else if ($name == 'html') {
            return FORMAT_HTML;
        } else if ($name == 'plain_text') {
            return FORMAT_PLAIN;
        } else if ($name == 'wiki_like') {
            return FORMAT_WIKI;
        } else if ($name == 'markdown') {
            return FORMAT_MARKDOWN;
        } else {
            debugging("Unrecognised text format '{$name}' in the import file. Assuming 'html'.");
            return FORMAT_HTML;
        }
    }
311944
public function resolve($name)
    {
        if (class_exists($name)) {
            return $name;
        }

        $name = static::normalise($name);

        $namespaces = clone $this->namespaces;

        $this->registerDefaultNamespace($namespaces);

        foreach (clone $namespaces as $ns) {
            $class = $ns . '\\' . $name;

            if (class_exists($class = $this->resolveClassAlias($class))) {
                if ($this->baseClass && !is_subclass_of($class, $this->baseClass)) {
                    throw new \DomainException(sprintf(
                        'Class: "%s" should be sub class of %s',
                        $class,
                        $this->baseClass
                    ));
                }

                return $class;
            }
        }

        throw new \DomainException(sprintf(
            'Can not find any classes with name: "%s" in package: "%s", namespaces: ( %s ).',
            $name,
            $this->package->getName(),
            implode(" |\n ", $namespaces->toArray())
        ));
    }
934309
public static function get($name)
    {
        if (!isset(static::$types[$name])) {
            if (!static::has($name)) {
                throw new \InvalidArgumentException(sprintf('The type "%s" does not exists.', $name));
            }

            static::$types[$name] = new static::$map[$name];
        }

        return static::$types[$name];
    }
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>');
    }
222536
public function getProvider(string $name) : string
    {
        $providers = $this->getProviders();
        if (!in_array($name, array_keys($providers))) {
            throw new InvalidArgumentException("Provider for [$name] is not configured");
        }

        return $providers[$name];
    }
940857
public function getFormat($name, $filePath, $mode) {
        $formats = $this->getFormats();
        if (!isset($formats[$name])) {
            throw new Exception("Format `$name` is not registered");
        }
        if (!is_callable($formats[$name])) {
            throw new Exception("Cannot generate format `$name`");
        }
        $format = call_user_func($formats[$name], $filePath, $mode);
        if (!$format instanceof Format) {
            throw new Exception("Cannot generate format `$name`");
        }
        return $format;
    }
771067
public function getDomain($name)
    {
        if (isset($this->domainMap[$name])) {
            return $this->domainMap[$name];
        }

        return null;
    }
554236
public function getFormElementDefinition($name)
    {
        if (array_key_exists($name, $this->namedFields)) {
            return $this->namedFields[$name];
        }

        throw new CMDLParserException('Could not find a formelement named ' . $name,
            CMDLParserException::CMDL_FORMELEMENT_NOT_FOUND);
    }