Get or create the extension

@return extension
351772
public Extensions getOrCreate() {

		// Create the attributes table
		if (!geoPackage.isTable(TABLE_NAME)) {

			AttributesColumn propertyColumn = AttributesColumn.createColumn(1,
					COLUMN_PROPERTY, GeoPackageDataType.TEXT, true, null);
			AttributesColumn valueColumn = AttributesColumn.createColumn(2,
					COLUMN_VALUE, GeoPackageDataType.TEXT, false, null);

			List<AttributesColumn> additionalColumns = new ArrayList<>();
			additionalColumns.add(propertyColumn);
			additionalColumns.add(valueColumn);

			List<UserUniqueConstraint<AttributesColumn>> uniqueConstraints = new ArrayList<>();
			uniqueConstraints.add(new UserUniqueConstraint<AttributesColumn>(
					propertyColumn, valueColumn));

			geoPackage.createAttributesTableWithId(TABLE_NAME,
					additionalColumns, uniqueConstraints);
		}

		Extensions extension = getOrCreate(EXTENSION_NAME, TABLE_NAME, null,
				EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE);

		return extension;
	}
918543
protected function getExtensions() {
        if (!$this->_extensions) {
            $this->_extensions = new AvailableAddOnExtensionList($this->version, $this->solution['sid']);
        }

        return $this->_extensions;
    }
281334
public function getExtension(
        /*# string */ $extensionName
    )/*# : ExtensionAbstract */ {
        if (!$this->hasExtension($extensionName)) {
            $this->addExtension(new $extensionName);
        }
        return $this->extensions[$extensionName];
    }
796031
protected function getExtensions() {
        if (!$this->_extensions) {
            $this->_extensions = new InstalledAddOnExtensionList($this->version, $this->solution['sid']);
        }

        return $this->_extensions;
    }
233119
public function withExtension(string $extension): self
    {
        if ($this->extension === $extension) {
            return $this;
        }

        $clone = clone $this;
        $clone->extension = strtolower($extension);

        return $clone;
    }
154565
public function get_extension(){
    parent::get_extension();
		if ( !$this->ext2 && $this->file ){
			if ( function_exists('exif_imagetype') ){
				if ( $r = exif_imagetype($this->file) ){
          if ( !array_key_exists($r, bbn\file\image::$allowed_extensions) ){
            $this->ext = false;
          }
				}
				else{
          $this->ext = false;
        }
			}
			if ( $this->ext ){
				$this->ext2 = $this->ext;
				if ( $this->ext2 === 'jpg' ){
          $this->ext2 = 'jpeg';
        }
			}
		}
		return $this->ext;
	}
648218
public function getFilenameWithExtension() {
		if ($this->extension === null) {
			return $this->filename;
		}
		else {
			return $this->filename . '.' . $this->extension;
		}
	}
539236
protected function storeExtension()
    {
        $entityManager = $this->getEntityManager();

        $extensionEntity = $entityManager->getEntity('Extension', $this->getProcessId());
        if (!isset($extensionEntity)) {
            $extensionEntity = $entityManager->getEntity('Extension');
        }

        $manifest = $this->getManifest();
        $fileList = $this->getCopyFileList();

        $data = array(
            'id' => $this->getProcessId(),
            'name' => trim($manifest['name']),
            'isInstalled' => true,
            'version' => $manifest['version'],
            'fileList' => $fileList,
            'description' => $manifest['description'],
        );

        if (!empty($manifest['checkVersionUrl'])) {
            $data['checkVersionUrl'] = $manifest['checkVersionUrl'];
        }

        $extensionEntity->set($data);

        return $entityManager->saveEntity($extensionEntity);
    }
524548
public function extend($name, ExtensionInterface $extension)
    {
        $this->getExtensions()->put($name, $extension);

        $extension->set($this);

        return $extension;
    }
895566
private function getShownExtension()
    {
        if($this->hasRequestParameter('shownExtension')){
            $shownExtension = $this->getRequestParameter('shownExtension');
            if(strlen(trim($shownExtension)) > 0){
                $extension = $this->getExtension($shownExtension);
                return $extension->getName();
            }
        }
        return null;
    }
676625
public function cacheExtension($extension = null)
    {
        if (empty($extension)) {
            return $this->cache_extension;
        }

        $this->cache_extension = $extension;

        return $this;
    }
547772
private function getExtension($name)
	{
		if (class_exists('Twig_Extensions_Extension_' . $name)) {
			$name = 'Twig_Extensions_Extension_' . $name;
		}
		elseif (class_exists('Twig_Extensions_Extension_' . ucfirst(strtolower($name)))) {
			$name = 'Twig_Extensions_Extension_' . ucfirst(strtolower($name));
		}
		elseif (!class_exists($name)) {
			throw new InvalidConfigException('Twig extension "' . $name . '" not declared.');
		}
		return new $name();
	}
1165921
public function getExtensions()
    {
        $data = [];
        foreach ($this->data['extensions'] as $extension) {
            $data[$extension['name']] = $extension['version'];
        }
        ksort($data);

        return $data;
    }
1202746
public function getNameWithExtension()
    {
        return $this->extension === '' ? $this->name : sprintf('%s.%s', $this->name, $this->extension);
    }
187831
public function getExtension()
    {
        if (!isset($this->file['name'])) {
            return null;
        }

        $extension = pathinfo(
            $this->file['name'],
            PATHINFO_EXTENSION
        );

        return strtolower($extension);
    }
525477
protected function getTwig()
    {
        if (null === $this->twig) {
            $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem(self::TEMPLATE_DIR), [
                'debug'            => true,
                'cache'            => false,
                'strict_variables' => true,
                'autoescape'       => false,
            ]);

            $this->twig->addExtension(new StringExtension());

            $class = sprintf(
                '\Gdbots\Pbjc\Generator\Twig\%sGeneratorExtension',
                StringUtils::toCamelFromSlug(static::LANGUAGE)
            );

            $this->twig->addExtension(new $class($this->compileOptions, $this));
        }

        return $this->twig;
    }
1162757
public function getAvailableExtensions(): Extensions
    {
        if ($this->availableExtensions instanceof Extensions) {
            return $this->availableExtensions;
        }
        $foundExtensions  = $this->filesystemFinder->findExtensions();
        $storedExtensions = app('antares.installed') ? $this->extensionsRepository->all() : new Collection();

        foreach ($foundExtensions as $foundExtension) {
            $extension = $storedExtensions->first(function(ExtensionModel $extensionModel) use($foundExtension) {
                return $extensionModel->getFullName() === $foundExtension->getPackage()->getName();
            });

            $configFile = $foundExtension->getPath() . '/resources/config/settings.php';

            if ($this->filesystem->exists($configFile)) {
                $foundExtension->setSettings($this->settingsFactory->createFromConfig($configFile));
            }

            if ($extension instanceof ExtensionModel) {
                $foundExtension->setStatus($extension->getStatus());
                $foundExtension->setIsRequired($extension->isRequired());
                $foundExtension->getSettings()->updateData($extension->getOptions());
            }
        }

        return $this->availableExtensions = $foundExtensions;
    }