Generate a link converter object from an array.

If type is empty, false is returned. This allows us to have predefined values from
value and target and do not throw an exception.

@param array $configuration
@return \luya\cms\LinkConverter|false
550640
public static function fromArray(array $configuration)
    {
        $type = ArrayHelper::getValue($configuration, 'type');
        $value = ArrayHelper::getValue($configuration, 'value');
        $target = ArrayHelper::getValue($configuration, 'target');
        
        if (empty($type)) {
            return false;
        }
        
        return (new self(['type' => $type, 'value' => $value, 'target' => $target]));
    }
1072298
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
    {
        if ($source instanceof \DateTimeInterface) {
            return $source->format('U');
        }

        if ($source === null || strlen($source) === 0) {
            return null;
        }

        if (!is_numeric($source)) {
            return new Error('"%s" is not numeric.', 1332933658, [$source]);
        }
        return (integer)$source;
    }
512563
protected function getTypeConverter($source, $targetType, $configuration)
    {
        $compositeType = $this->parseCompositeType($targetType);

        if (in_array($compositeType, ['\\ArrayObject', 'array'])) {
            $typeConverter = $this->objectManager->get(ArrayConverter::class);
        } else {
            $typeConverter = $this->findTypeConverter($source, $targetType, $configuration);

            if ($typeConverter instanceof ExtbaseArrayConverter) {
                $typeConverter = $this->objectManager->get(ArrayConverter::class);
            } elseif ($typeConverter instanceof ObjectConverter) {
                $typeConverter = $this->getObjectConverter();
            }
        }

        if (!is_object($typeConverter) || !$typeConverter instanceof TypeConverterInterface) {
            throw new TypeConverterException('Type converter for "' . $source . '" -> "' . $targetType . '" not found.');
        }

        return $typeConverter;
    }
816439
protected function getRoutesFromConfiguration(array $configuration)
    {
        // Result
        $routes = [];

        // Convert routes to same context as from presenter
        foreach ($configuration as $route => $config) {

            // Check for method and set DEFAULT to GET if not set
            if (isset($config->methods) && null !== $config->methods) {
                $methods = explode(',', $config->methods);
            } else {
                $methods = [Doozr_Http::REQUEST_METHOD_GET];
            }

            foreach ($methods as $method) {
                if (false === isset($routes[$method])) {
                    $routes[$method] = [];
                }
                $config->route           = $route;
                $routes[$method][$route] = $config;
            }
        }

        return $routes;
    }
1297368
public function setConfiguration(array $configuration): ConfigurationProviderInterface
    {
        if (isset($configuration['configuration']) && $configuration['configuration']) {
            $configuration = array_merge(
                $configuration,
                $this->load($configuration['configuration']),
                array_filter($configuration)
            );
        }

        $this->configuration = $configuration;

        return $this;
    }
449578
public function supports(ParamConverter $configuration)
    {
        if (null === $configuration->getClass()) {
            return false;
        }

        if(array_key_exists($configuration->getClass(), $this->targetEntitiesArray))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
67635
public static function create(array $configuration)
    {
        $currentConfiguration = is_array($configuration) ? array_merge(self::$defaultConfiguration, $configuration)
            : self::$defaultConfiguration;

        $class = self::className($currentConfiguration);

        $adapter = new $class($currentConfiguration[Config::PARAMS]);

        return new Storage($adapter);
    }
488480
public function expand(array $options = [])
    {
        if (!empty($this->href)) {
            return $this->href;
        } else if (!empty($this->{'href-template'})) {
            $parser = new UriTemplate();
            return $parser->expand($this->{'href-template'}, $this->_convertOptions($options));
        } else {
            throw new LinkException('Cannot expand link because no href or href-template defined');
        }
    }
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;
	}
687695
public function build(array $configuration, $presetName)
    {
        $formDefaults = $this->getPresetConfiguration($presetName);

        $form = isset($configuration['type']) ?
            new FormDefinition($configuration['identifier'], $formDefaults, $configuration['type']) :
            new FormDefinition($configuration['identifier'], $formDefaults);

        if (isset($configuration['renderables'])) {
            foreach ($configuration['renderables'] as $pageConfiguration) {
                $this->addNestedRenderable($pageConfiguration, $form);
            }
        }

        unset($configuration['renderables']);
        unset($configuration['type']);
        unset($configuration['identifier']);
        unset($configuration['label']);
        $form->setOptions($configuration);

        $this->triggerFormBuildingFinished($form);

        return $form;
    }
1281813
public function configure(array $configuration) : bool
    {
        //====================================================================//
        // Setup Connector Configuration
        $this->getConnector()->configure(
            $this->getWebserviceId(),
            $this->getWebserviceId(),
            $configuration
        );
        //====================================================================//
        // Mark Connector as Configured
        return $this->identified = true;
    }
1002549
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
    {
        if ($source instanceof NodeType) {
            return $source->getName();
        }

        return '';
    }
934265
public static function initField($configuration = [])
    {
        if (!array_key_exists('type', $configuration) || !class_exists($configuration['type'])) {
            throw new InvalidFieldTypeException('You did not specify a type on this class.');
        }

        $collection = new static();
        $collection->configuration = $configuration;
        $collection->type = $configuration['type'];

        if (array_key_exists('max_items', $configuration)) {
            $collection->maxItems = $configuration['max_items'];
        }

        return $collection;
    }
526255
protected function loadConfigurationRecursive(ContainerBuilder $container, array $configuration)
    {
        foreach ($configuration as $values) {
            $loader = new XmlFileLoader($container, new FileLocator($values['path']));
            foreach ($values['configFiles'] as $configFile) {
                $loader->load($configFile);
            }
            if (array_key_exists('configuration', $values)) {
                $this->loadConfigurationRecursive($container, $values['configuration']);
            }
        }
    }
275669
private function checkTransitionsConfiguration(array $configuration)
    {
        foreach ($configuration as $transitionConfiguration) {
            if (
                is_array($transitionConfiguration) &&
                (count($transitionConfiguration) === 3) &&
                isset($transitionConfiguration[0]) &&
                is_string($transitionConfiguration[0]) &&
                $transitionConfiguration[0] &&
                isset($transitionConfiguration[1]) &&
                is_string($transitionConfiguration[1]) &&
                $transitionConfiguration[1] &&
                isset($transitionConfiguration[2]) &&
                is_string($transitionConfiguration[2]) &&
                $transitionConfiguration[2]
            ) {
                return $this;
            }
        }

        throw new TransitionNotValidException();
    }
1262222
public function checkMethods(array $configuration)
    {
        foreach ($configuration as $classNamespace => $classConfiguration) {
            if (
                !isset($classConfiguration['idGetter']) ||
                !method_exists($classNamespace, $classConfiguration['idGetter']) ||
                !isset($classConfiguration['fields']) ||
                !is_array($classConfiguration['fields'])
            ) {
                throw new TranslationDefinitionException();
            }

            foreach ($classConfiguration['fields'] as $fieldName => $fieldConfiguration) {
                if (
                    $fieldName &&
                    $fieldConfiguration &&
                    is_array($fieldConfiguration) &&
                    isset($fieldConfiguration['getter']) &&
                    method_exists($classNamespace, $fieldConfiguration['getter']) &&
                    isset($fieldConfiguration['setter']) &&
                    method_exists($classNamespace, $fieldConfiguration['setter'])
                ) {
                    continue;
                }

                throw new TranslationDefinitionException(
                    'Field ' . $classNamespace . ' not found, or methods [' . $fieldConfiguration['getter'] . ', ' . $fieldConfiguration['setter'] . '] not found inside the class'
                );
            }
        }

        return $this;
    }
320974
public function map(array $configuration)
	{

        $defaults = ['pooled' => false];
        $optional = ['servicename', 'instancename'];

        foreach ($optional as $opt) {
            if(isset($configuration[$opt]))
                $defaults[$opt] = $configuration[$opt];
        }

		return array_merge($defaults, [
			'driver' => $this->driver($configuration['driver']),
            'port' => @$configuration['port'] ? $configuration['port'] : 1521,
			'host' => $configuration['host'],
			'dbname' => $configuration['database'],
			'user' => $configuration['username'],
			'password' => $configuration['password'],
            'charset' => $configuration['charset'],
            'prefix' => @$configuration['prefix'] ? $configuration['prefix'] : null
		]);
	}