@param $extension

Get Parser depending on extension
@return null
@throws Exception
964474
private function _getParser($extension)
    {
        $parser = null;
        foreach ($this->_supportedFileParsers as $fileParser) {
            $tempParser = new $fileParser;
            if (in_array($extension, $tempParser->getSupportedExtensions($extension))) {
                $parser = $tempParser;
                continue;
            }
        }
        if ($parser === null) {
            throw new Exception('Unsupported configuration format');
        }

        return $parser;
    }
203660
public static function getTypeForExtension($extension) {
		static::ensureDataLoaded();

		$extension = strtolower($extension);
		foreach (static::$mime_types as $mime_type => $extensions) {
			if (is_array($extensions)) {
				if (in_array($extension, $extensions, true)) {
					return $mime_type;
				}
			} else if ($extension === $extensions) {
				return $mime_type;
			}
		}
	}
676625
public function cacheExtension($extension = null)
    {
        if (empty($extension)) {
            return $this->cache_extension;
        }

        $this->cache_extension = $extension;

        return $this;
    }
1186727
public function getExtensionInstance($extension)
    {
        $instances = $this->getExtensionInstances();
        if (array_key_exists($extension, $instances)) {
            return $instances[$extension];
        }
        // in case Injector has been used to replace an extension
        foreach ($instances as $instance) {
            if (is_a($instance, $extension)) {
                return $instance;
            }
        }
        return null;
    }
1303136
public function getCompiler(string $extension): CompilerStrategy
    {
        if (!$this->hasCompiler($extension)) {
            throw new ViewException('View compiler for extension `' . $extension . '` not found.');
        }

        $compiler = &$this->compilers[$extension];

        if (is_callable($compiler)) {
            $compiler = call_user_func_array($compiler, [$this]);
        }

        if (!($compiler instanceof CompilerStrategy)) {
            throw new ViewException('View compiler for extension `' . $extension . '` should be an instance of `' . CompilerStrategy::class . '`.');
        }

        return $compiler;
    }
1136181
public function toMimeType($extension)
    {
        $extension = strtolower($extension);

        if (array_key_exists($extension, $this->dict)) {
            return $this->dict[$extension];
        }
    }
843816
public function getOutExtension($extension)
    {
        if (isset($this->extensionMap[$extension])) {
            return $this->extensionMap[$extension];
        }

        return $extension;
    }
239535
protected function getParser($extension)
    {
        foreach ($this->supportedParsers as $parser) {
            if (in_array($extension, $parser::getSupportedExtensions())) {
                return new $parser();
            }
        }

        // If none exist, then throw an exception
        throw new UnsupportedFormatException('Unsupported configuration format');
    }
30037
public static function getSupportedExtensions($extension)
    {
        foreach (static::$_registry as $registered) {
            if (in_array($extension, (array) $registered['extensions'])) {
                return $registered['extensions'];
            }
        }

        throw new ErrorException("The following extension is not handled: {$extension}");
    }
925502
public function resolveFilename($extension = null)
    {
        if ($extension === null) {
            $extension = $this->extension;
        }
        return $this->name . '-' . $this->id . '.' . $extension;
    }
1014133
protected function setHandlerByExtension($extension)
    {
        if (!in_array($extension, $this->file->supportedExtensions())) {
            throw new RuntimeException($this->translation->text('Unsupported file extension'));
        }

        return $this->handler = $this->file->getHandler(".$extension");
    }
889886
private function fetchDomain($extension)
    {
        if (!array_key_exists($extension = strtolower($extension), $this->mediaDomainsMap)) {
            throw new UnsupportedFileException(sprintf(
                'Extension ".%s" isnt supported by Media component, only ["%s"] are.',
                $extension,
                implode('", "', array_keys($this->mediaDomainsMap))
            ));
        }

        return $this->mediaDomainsMap[$extension];
    }
908710
public function setFileExtension($extension)
  {
    if ($this->isLocked()) {
      return $this->getObj()->setFileExtension($extension)->setLocked();
    } else {
      return parent::setFileExtension($extension);
    }
  }
889504
public function getFormatForFileExtension($extension)
    {
        $format = $this->getConfiguredFormat();
        if ($format === static::FORMAT_AUTO) {
            $format = $this->getAutomaticFormatForFileExtension((string) $extension);
        }

        return $format;
    }
1147479
public static function getMimeByExtension($extension, $default = 'application/octet-stream')
    {
        $extension = strtolower($extension);

        // look for some standard types
        switch ($extension) {
            case null:
                return $default;
            case 'json':
                return 'application/json';
            case 'html':
                return 'text/html';
            case 'atom':
                return 'application/atom+xml';
            case 'rss':
                return 'application/rss+xml';
            case 'xml':
                return 'application/xml';
        }

        $media_types = Grav::instance()['config']->get('media.types');

        if (isset($media_types[$extension])) {
            if (isset($media_types[$extension]['mime'])) {
                return $media_types[$extension]['mime'];
            }
        }

        return $default;
    }
680116
public function getHandler($extension)
	{
		if (isset($this->handlers[$extension]))
		{
			return $this->handlers[$extension];
		}

		$class = 'Fuel\Config\Handler\\'.ucfirst($extension);

		if ( ! class_exists($class, true))
		{
			throw new \RuntimeException('Could not find config handler for extension: '.$extension);
		}

		$handler = new $class;
		$this->handlers[$extension] = $handler;

		return $handler;
	}
198886
public function getName($extension = self::WITH_EXTENSION) {
    if (isset($this->extension) && $extension == self::WITH_EXTENSION)
      return $this->name.'.'.$this->extension;
    else
      return $this->name;
  }