Adds the file extensions

@param  string|array $extension The extensions to add for validation
@return Zend_Validate_File_Extension Provides a fluent interface
349181
public function addExtension($extension)
    {
        $extensions = $this->getExtension();
        if (is_string($extension)) {
            $extension = explode(',', $extension);
        }

        foreach ($extension as $content) {
            if (empty($content) || !is_string($content)) {
                continue;
            }

            $extensions[] = trim($content);
        }
        $extensions = array_unique($extensions);

        // Sanity check to ensure no empty values
        foreach ($extensions as $key => $ext) {
            if (empty($ext)) {
                unset($extensions[$key]);
            }
        }

        $this->_extension = implode(',', $extensions);

        return $this;
    }
458372
public function setViewsExtension(string $extension)
  {
    if (substr($extension, 0, 1) != '.') {
      $this->viewsExtension = '.' . $extension;
      return $this;
    }

    $this->viewsExtension = $extension;
    return $this;
  }
820076
public static function fromExtension($extension)
	{
		$extension = strtolower($extension);

		return isset(static::$mimetypes[$extension])
			? static::$mimetypes[$extension]
			: null;
	}
173134
public function filterByExtension($extension)
    {
        $extensions = is_array($extension) ? $extension : [$extension];
        if (count($extensions) > 0) {
            $expr = $this->query->expr();
            $or = $expr->orX();
            foreach ($extensions as $extension) {
                $extension = ltrim((string) $extension, '.');
                $or->add($expr->eq('fv.fvExtension', $this->query->createNamedParameter($extension)));
                if ($extension === '') {
                    $or->add($expr->isNull('fv.fvExtension'));
                }
            }
            $this->query->andWhere($or);
        }
    }
524548
public function extend($name, ExtensionInterface $extension)
    {
        $this->getExtensions()->put($name, $extension);

        $extension->set($this);

        return $extension;
    }
923124
private function loadExtensions($extensions)
    {
        $extensions = Arr::wrap($extensions);

        foreach ($extensions as $extension) {
            $extension = 'ext'.$extension;

            if (method_exists($this, $extension)) {
                $this->$extension();
            }
        }
    }
940632
public function compoundFileLength($extension)
    {
        if (($extension == '.fdx'  || $extension == '.fdt')  &&  $this->_usesSharedDocStore) {
            $filename = $this->_sharedDocStoreOptions['segment'] . $extension;

            if (!$this->_sharedDocStoreOptions['isCompound']) {
                return $this->_directory->fileLength($filename);
            }

            if( !isset($this->_sharedDocStoreOptions['fileSizes'][$filename]) ) {
                require_once 'Zend/Search/Lucene/Exception.php';
                throw new Zend_Search_Lucene_Exception('Shared doc store compound file doesn\'t contain '
                                           . $filename . ' file.' );
            }

            return $this->_sharedDocStoreOptions['fileSizes'][$filename];
        }


        $filename = $this->_name . $extension;

        // Try to get common file first
        if ($this->_directory->fileExists($filename)) {
            return $this->_directory->fileLength($filename);
        }

        if( !isset($this->_segFileSizes[$filename]) ) {
            require_once 'Zend/Search/Lucene/Exception.php';
            throw new Zend_Search_Lucene_Exception('Index compound file doesn\'t contain '
                                       . $filename . ' file.' );
        }

        return $this->_segFileSizes[$filename];
    }
6833
public function setTemplateExtension($extension)
    {
        $extension = (string) $extension;
        $extension = trim($extension);
        if ('.' == $extension[0]) {
            $extension = substr($extension, 1);
        }

        $this->extension = $extension;
    }
619675
public function extension($extension = null)
    {
        if (is_null($extension)) {
            if (!empty($this->extension)) {
                return $this->extension;
            }
            if (isset($this->attributes['extension'])) {
                return $this->attributes['extension'];
            }
        }
        $this->extension = $this->checkExtension($extension);

        return $this;
    }
795081
public function extension($extension = false)
    {
        if($extension === false) {
            return $this->adapter->extension($this->path);
        }

        $newName = $this->name();
        $index = strrpos($newName, '.');
        if ($index !== false) {
            $newName = substr($newName, 0, $index + 1);
        } else {
            $newName .= '.';
        }
        $newName .= $extension;

        return $this->name($newName);
    }
754409
public function addDependentExtensions(array $extensions)
    {
        $this->addExtensions($extensions);

        foreach ($extensions as $rule => $extension) {
            $this->dependentRules[] = Str::studly($rule);
        }
    }
844781
public function add(ExtensionInterface $extension, DirectoryInterface $baseDir = null, DirectoryInterface $webDir = null, $composerName = null)
    {
        if ($this->registered) {
            throw new \RuntimeException('Can not add extensions after they are registered.');
        }

        // Set paths in the extension
        if ($baseDir === null) {
            // If there is no base dir we just default to the same directory as the extension class is in.
            $reflector = new ReflectionClass($extension);
            $dir = dirname($reflector->getFileName());
            if (basename($dir) === 'src') {
                $dir = dirname($dir);
            } elseif (basename(dirname($dir)) === 'src') {
                $dir = dirname(dirname($dir));
            }
            $fs = new Filesystem(new Local($dir));

            $baseDir = $fs->getDir('/');
        }
        $extension->setBaseDirectory($baseDir);

        if ($webDir === null) {
            $webDir = $this->webFs->getDir($extension->getId());
        }
        $extension->setWebDirectory($webDir);

        // Determine if enabled
        $enabled = $this->config->get('extensions/' . $extension->getId(), true);

        if ($composerName !== null) {
            // Map composer name to ID
            $this->composerNames[$composerName] = $extension->getId();

            // Check if enabled by composer name
            $enabled = $this->config->get("extensions/$composerName", $enabled);
        }

        // Instantiate resolved extension and mark enabled/disabled
        $resolved = (new ResolvedExtension($extension))
            ->setEnabled($enabled)
        ;

        return $this->extensions[$extension->getId()] = $resolved;
    }
552805
public function addExtensions($extensions)
    {
        $extensions = array_merge($this->_extensions, (array)$extensions);
        $this->_extensions = array_unique($extensions);
    }
936320
public function addExtension(ExtensionInterface $extension)
    {
        if (array_key_exists($name = $extension->getName(), $this->extensions)) {
            throw new \RuntimeException(sprintf('UserExtension "%s" is already registered.', $name));
        }

        $this->extensions[$name] = $extension;
    }
483083
public function setExtensions(array $extensions)
    {
        foreach ($extensions as $extension) {
            $this->checkType(CmisExtensionElementInterface::class, $extension);
        }

        $this->extensions = $extensions;
    }
85182
public function setExtension(string $extension) {
        if(!$this->setModified('extension', $extension)->isModified()) {
            return $this;
        }
		$this->extension = $extension;
		return $this;
    }
281591
private function loadFileExtensions($extensions)
    {
        foreach ($extensions as $extension) {
            $extension_name = preg_replace('/^\.?/', '', (string)$extension['name']);
            $this->file_extensions[] = $extension_name;

            if (isset($extension['scanner'])) {
                $path = $this->base_dir . (string)$extension['scanner'];

                if (!file_exists($path)) {
                    throw new Exception\ConfigException('Error parsing config: cannot find file ' . $path);
                }

                $this->filetype_scanner_paths[$extension_name] = $path;
            }

            if (isset($extension['checker'])) {
                $path = $this->base_dir . (string)$extension['checker'];

                if (!file_exists($path)) {
                    throw new Exception\ConfigException('Error parsing config: cannot find file ' . $path);
                }

                $this->filetype_analyzer_paths[$extension_name] = $path;
            }
        }
    }