reads and parses an ini string and writes the results into the cache

@param \BrowscapPHP\Helper\ConverterInterface $converter
@param string                                 $content
@param int|null                               $cachedVersion
768350
private function storeContent(ConverterInterface $converter, string $content, ?int $cachedVersion) : void
    {
        $iniString = $this->sanitizeContent($content);
        $iniVersion = $converter->getIniVersion($iniString);

        if (! $cachedVersion || $iniVersion > $cachedVersion) {
            $converter->storeVersion();
            $converter->convertString($iniString);
        }
    }
152012
protected function execute(InputInterface $input, OutputInterface $output) : int
    {
        $logger = LoggerHelper::createDefaultLogger($output);

        /** @var string $cacheOption */
        $cacheOption = $input->getOption('cache');
        $fileCache = new FilesystemCache($cacheOption);
        $cache = new SimpleCacheAdapter($fileCache);

        $logger->debug('started checking for new version of remote file');

        $browscap = new BrowscapUpdater($cache, $logger);

        try {
            $browscap->checkUpdate();
        } catch (NoCachedVersionException $e) {
            return 1;
        } catch (NoNewVersionException $e) {
            // no newer version available
            $logger->info('there is no newer version available');

            return 2;
        } catch (ErrorCachedVersionException $e) {
            $logger->info($e);

            return 3;
        } catch (FetcherException $e) {
            $logger->info($e);

            return 4;
        } catch (\Throwable $e) {
            $logger->info($e);

            return 5;
        }

        $logger->debug('finished checking for new version of remote file');

        return 0;
    }
1075487
public static function ToType( $value, $conversionType, $provider = null )
	{
		if ( is_null( $value ) ) return null;

		$valueType = Type::FromValue( $value );

		if ( $valueType->getFullName() ==  $conversionType->getFullName() )
			return $value;

		switch( $conversionType->getFullName() )
		{
			case Type::bool:
				return Convert::ToBoolean( $value, $provider );

			case Type::datetime:
				return Convert::ToDateTime( $value, $provider );

			case DecimalValue::$CLASSNAME:
			case Type::decimal:
				return Convert::ToDecimal( $value, $provider );

			case Type::double:
				return Convert::ToDouble( $value, $provider );

			case Type::float:
				return Convert::ToSingle( $value, $provider );

			case Type::int:
				return Convert::ToInt( $value, $provider );

			case Type::long:
				return Convert::ToInt64( $value, $provider );

			case Type::string:
				return Convert::ToString( $value, $provider );

			default:
				throw new NotSupportedException( "Conversion from {$valueType->getFullName()} to {$conversionType->getFullName()} not supported" );
		}

	}
929256
public function getFromCache($type, $slotname, PageVersion $version)
    {
        $key = $this->getCacheKey($type, $slotname, $version);

        return $this->cache->get($key, false);
    }
499814
protected function getConverterWithOptions($converterName, $attribute)
    {
        $converter = AttributeConverterFactory::get($converterName);
        $converter->setOptions(array_merge(
            $this->schema->getConverterOptions($converterName, '_default'),
            $this->schema->getConverterOptions($converterName, $attribute)
        ));
        $converter->setOperationType($this->type);
        $converter->setLdapConnection($this->connection);
        $converter->setDn($this->dn);

        if ($converter instanceof OperationGeneratorInterface) {
            $converter->setOperation($this->operation);
        }

        return $converter;
    }
1272678
public function poll_conversion(conversion $conversion) {
        $format = $conversion->get('targetformat');
        $file = $conversion->get_sourcefile();

        if ($conversion->get('status') == conversion::STATUS_IN_PROGRESS) {
            // The current conversion is in progress.
            // Check for updates.
            if ($instance = $conversion->get_converter_instance()) {
                $instance->poll_conversion_status($conversion);
            } else {
                // Unable to fetch the converter instance.
                // Reset the status back to PENDING so that it may be picked up again.
                $conversion->set('status', conversion::STATUS_PENDING);
            }
            $conversion->update();
        }

        // Refresh the status.
        $status = $conversion->get('status');
        if ($status === conversion::STATUS_PENDING || $status === conversion::STATUS_FAILED) {
            // The current status is either pending or failed.
            // Attempt to pick up a new converter and convert the document.
            $from = pathinfo($file->get_filename(), PATHINFO_EXTENSION);
            $converters = $this->get_document_converter_classes($from, $format);
            $currentconverter = $this->get_next_converter($converters, $conversion->get('converter'));

            if (!$currentconverter) {
                // No more converters available.
                $conversion->set('status', conversion::STATUS_FAILED);
                $conversion->update();
                return $this;
            }

            do {
                $conversion
                    ->set('converter', $currentconverter)
                    ->set('status', conversion::STATUS_IN_PROGRESS)
                    ->update();

                $instance = $conversion->get_converter_instance();
                $instance->start_document_conversion($conversion);
                $failed = $conversion->get('status') === conversion::STATUS_FAILED;
                $currentconverter = $this->get_next_converter($converters, $currentconverter);
            } while ($failed && $currentconverter);

            $conversion->update();
        }

        return $this;
    }
785483
public function getReader($reInitiate = false) : ReaderInterface
    {
        if ($reInitiate === true || $this->reader === null) {
            $directory = $this->getDataDirectory();

            if (!$this->isDirectoryReadable($directory)) {
                throw new ParserConfigurationException("Directory '$directory' is not readable.", 1458974128);
            }

            $this->reader = new Reader($directory);
            $this->reader->setPropertyFilter($this->getPropertyFilter());
            $this->reader->setDataVersionHash($this->getDataVersionHash());
        }

        return $this->reader;
    }
563033
public function setEncoding($encoding, $convertEncoding = null)
    {
        $supportedEncodings = static::getSupportedEncodings();

        $encodingUpper = strtoupper($encoding);
        if (!in_array($encodingUpper, $supportedEncodings)) {
            throw new Exception\InvalidArgumentException(
                'Wrapper doesn\'t support character encoding "' . $encoding . '"'
            );
        }

        if ($encodingUpper !== strtoupper($convertEncoding)) {
            $this->convertEncoding = $encodingUpper;
        }

        if ($convertEncoding !== null) {
            if ($encodingUpper !== strtoupper($convertEncoding)) {
                throw new Exception\InvalidArgumentException(
                    'Wrapper doesn\'t support to convert between character encodings'
                );
            }

            $this->convertEncoding = $encodingUpper;
        } else {
            $this->convertEncoding = null;
        }
        $this->encoding = $encodingUpper;

        return $this;
    }
327941
public void init(Converter converter, Converter converterAlt)
    {
        m_bEnableTranslation = true;
        m_bSetData = false;
        super.init(converter);
        if (converterAlt != null)
            this.addConverterToPass(converterAlt);
    }
1104152
protected function converter_deps($main_setting, $converters) {
        foreach ($this->settings as $setting) {
            $name = $setting->get_name();
            if (in_array($name, $converters)) {
                $setvalue = convert_helper::export_converter_dependencies($name, $main_setting->get_name());
                if ($setvalue !== false) {
                    $setting->add_dependency($main_setting, $setvalue, array('value' => $name));
                }
            }
        }
    }
787846
public function performConversions(ConversionCollection $conversions, Media $media, $onlyIfMissing = false)
    {
        if ($conversions->isEmpty()) {
            return;
        }

        $imageGenerator = $this->determineImageGenerator($media);

        if (! $imageGenerator) {
            return;
        }

        $temporaryDirectory = TemporaryDirectory::create();

        $copiedOriginalFile = app(Filesystem::class)->copyFromMediaLibrary(
            $media,
            $temporaryDirectory->path(str_random(16).'.'.$media->extension)
        );

        $conversions
            ->reject(function (Conversion $conversion) use ($onlyIfMissing, $media) {
                $relativePath = $media->getPath($conversion->getName());

                $rootPath = config('filesystems.disks.'.$media->disk.'.root');

                if ($rootPath) {
                    $relativePath = str_replace($rootPath, '', $relativePath);
                }

                return $onlyIfMissing && Storage::disk($media->disk)->exists($relativePath);
            })
            ->each(function (Conversion $conversion) use ($media, $imageGenerator, $copiedOriginalFile) {
                event(new ConversionWillStart($media, $conversion, $copiedOriginalFile));

                $copiedOriginalFile = $imageGenerator->convert($copiedOriginalFile, $conversion);

                $manipulationResult = $this->performManipulations($media, $conversion, $copiedOriginalFile);

                $newFileName = pathinfo($media->file_name, PATHINFO_FILENAME).
                    '-'.$conversion->getName().
                    '.'.$conversion->getResultExtension(pathinfo($copiedOriginalFile, PATHINFO_EXTENSION));

                $renamedFile = MediaLibraryFileHelper::renameInDirectory($manipulationResult, $newFileName);

                if ($conversion->shouldGenerateResponsiveImages()) {
                    app(ResponsiveImageGenerator::class)->generateResponsiveImagesForConversion(
                        $media,
                        $conversion,
                        $renamedFile
                    );
                }

                app(Filesystem::class)->copyToMediaLibrary($renamedFile, $media, 'conversions');

                $media->markAsConversionGenerated($conversion->getName(), true);

                event(new ConversionHasBeenCompleted($media, $conversion));
            });

        $temporaryDirectory->delete();
    }
22947
public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = NULL) {
		$object = $this->buildObject($convertedChildProperties, $targetType);
		foreach ($convertedChildProperties as $propertyName => $propertyValue) {
			ObjectAccess::setProperty($object, $propertyName, $propertyValue);
		}

		return $object;
	}
659879
@Override
	public void initialized(ICacheManager cacheManager) {
		final String sourceMethod = "initialized"; //$NON-NLS-1$
		final boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(sourceClass, sourceMethod);
		}
		// Cache manager is initialized.  De-register the listener and add our named cache
		cacheMgrListenerReg.unregister();
		JsxConverter converter = newConverter();
		IGenericCache cache = newCache(converter, "jsx.", ""); //$NON-NLS-1$ //$NON-NLS-2$
		cache.setAggregator(aggregator);
		ResourceConverterCacheImpl oldCache = (ResourceConverterCacheImpl)cacheManager.getCache().putIfAbsent(JSX_CACHE_NAME, cache);
		if (oldCache != null) {
			converter = (JsxConverter)oldCache.getConverter();
		}
		if (isTraceLogging) {
			log.logp(Level.FINER, sourceClass, sourceMethod, "Initializing resource converter" + (oldCache != null ? " from cache." : ".")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		}
		converter.initialize(es, xformerRes.getURI());

		if (isTraceLogging) {
			log.exiting(sourceClass, sourceMethod);
		}
	}
959388
public static function replaceSpecialRange(SemverConverter $converter, $match)
    {
        $newMatch = $converter->convertVersion($match);
        $newMatch = '>='.static::standardizeVersion(SemverUtil::replaceAlias($newMatch, '>')).',<';
        $exp = static::getSplittedVersion($match);
        $increase = false;

        foreach ($exp as $i => $sub) {
            if (static::analyzeSubVersion($i, $exp, $increase)) {
                continue;
            }

            static::increaseSubVersion($i, $exp, $increase);
        }

        $newMatch .= $converter->convertVersion(static::standardizeVersion($exp));

        return $newMatch;
    }
968074
public TreeBuilder<T> convert(ContentConverter<T> converter, PathSelector selector) {
        return TreeBuilder.<T>builder(new ConverterTree<T>(build(), converter, selector));
    }
380524
public static function encode(
        $cacheVersion = WurflConstants::API_NAMESPACE,
        $namespace = AbstractAdapter::DEFAULT_NAMESPACE,
        $cacheId = ''
    ) {
        $cacheId = implode(':', array($cacheVersion, $namespace, $cacheId));

        return hash('sha512', $cacheId);
    }
253693
protected function updateField(Field $field, Content $content)
    {
        $this->contentGateway->updateField(
            $field,
            $this->mapper->convertToStorageValue($field)
        );

        // If the storage handler returns true, it means that $field value has been modified
        // So we need to update it in order to store those modifications
        // Field converter is called once again via the Mapper
        if ($this->storageHandler->storeFieldData($content->versionInfo, $field) === true) {
            $this->contentGateway->updateField(
                $field,
                $this->mapper->convertToStorageValue($field)
            );
        }
    }