@param string $path
The path where to espect the configuration.
@param array $provider
The provider configuration.

@return array
@throws \Surfnet\SamlBundle\Exception\SamlInvalidConfigurationException
the certificate data
192645
private function parseCertificateData($path, array $provider)
    {
        if (isset($provider['certificate_file']) && !isset($provider['certificate'])) {
            $configuration['certificateFile'] = $provider['certificate_file'];
        } elseif (isset($provider['certificate'])) {
            $configuration['certificateData'] = $provider['certificate'];
        } else {
            throw SamlInvalidConfigurationException::missingCertificate($path);
        }

        return $configuration;
    }
155277
protected function assertValidPath($path)
    {
        $translator = $this->translator();

        if (empty($path) && !is_numeric($path)) {
            $message = $translator->translate(
                '{{ parameter }} required and must be a {{ expectedType }}',
                [
                    '{{ parameter }}'    => '"path"',
                    '{{ expectedType }}' => 'string',
                ]
            );

            throw new InvalidArgumentException($message, 400);
        } elseif (!is_string($path)) {
            $actualType = is_object($path) ? get_class($path) : gettype($path);
            $message = $translator->translate(
                '{{ parameter }} must be a {{ expectedType }}, received {{ actualType }}',
                [
                    '{{ parameter }}'    => '"path"',
                    '{{ expectedType }}' => 'string',
                    '{{ actualType }}'   => $actualType,
                ]
            );

            throw new InvalidArgumentException($message, 400);
        }
    }
1170017
public function toProvider(string $provider)
    {
        if (! class_exists($provider)) {
            throw new NotFound($provider);
        }
        if (! (new \ReflectionClass($provider))->implementsInterface(ProviderInterface::class)) {
            throw new InvalidProvider($provider);
        }
    }
927175
public function setClientCertificatePath(array $path = null)
    {
        ValidationUtility::ensureNullOrArrayOfString('$path', $path);

        $this->clientCertificatePath = $path;

        return $this;
    }
906622
private function getValidPath($path)
    {
        // If `$path` is array
        if (is_array($path)) {
            return $this->getPathFromArray($path);
        }

        // If `$path` is a directory
        if (is_dir($path)) {
            $paths = glob($path . '/*.*');
            if (empty($paths)) {
                throw new EmptyDirectoryException("Configuration directory: [$path] is empty");
            }
            return $paths;
        }

        // If `$path` is not a file, throw an exception
        if (!file_exists($path)) {
            throw new FileNotFoundException("Configuration file: [$path] cannot be found");
        }
        return array($path);
    }
764621
public static function pathsToPublishAdmin($provider = null, $group = null)
	{
		if ($group && array_key_exists($group, static::$publishGroupsAdmin))
		{
			return static::$publishGroupsAdmin[$group];
		}

		if ($provider && array_key_exists($provider, static::$publishesAdmin))
		{
			return static::$publishesAdmin[$provider];
		}

		if ($group || $provider)
		{
			return [];
		}

		$paths = [];

		foreach (static::$publishesAdmin as $class => $publish)
		{
			$paths = array_merge($paths, $publish);
		}

		return $paths;
	}
780987
protected function ensurePathExists($path, array $config)
    {
        if ($this->has($path)) {
            return $this->getMetadata($path)['type'] === 'dir';
        }

        $info = $this->getPathInfo($path);

        return \is_array($this->createDir($info['path'], $config));
    }
95733
protected function getPathFromConfiguration($path, ConfigurationInterface $configuration)
    {
        if ($configuration->hasRelativePath()) {
            return $configuration->getRelativePathToFile($path);
        }

        if ($configuration->hasPublicURL()) {
            return $configuration->getPublicURLToFile($path);
        }

        throw new \InvalidArgumentException('Thumbnail configuration doesn\'t support Paths or URLs');
    }
954190
final public function get(array $appConfig): array
    {
        $this->appConfig = $appConfig;

        $defaults = $this->getSettings();

        $credentialsValidator = $defaults[static::KEY_USER_CREDENTIALS_VALIDATOR];
        assert(
            $this->checkPublicStaticCallable(
                $credentialsValidator,
                [ContainerInterface::class, 'string', 'string']
            ),
            "Invalid credentials validator."
        );

        $scopeValidator = $defaults[static::KEY_USER_SCOPE_VALIDATOR] ?? null;
        assert(
            $this->checkPublicStaticCallable(
                $scopeValidator,
                [
                    ContainerInterface::class,
                    'int',
                    function (ReflectionParameter $parameter) {
                        return $parameter->allowsNull() === true && $parameter->isArray() === true;
                    },
                ]
            ),
            "Invalid scope validator."
        );

        $customPropsProvider = $defaults[static::KEY_TOKEN_CUSTOM_PROPERTIES_PROVIDER] ?? null;
        assert(
            $customPropsProvider === null ||
            $this->checkPublicStaticCallable(
                $customPropsProvider,
                [ContainerInterface::class, TokenInterface::class],
                'array'
            ),
            "Invalid token custom properties provider."
        );

        $customUnAuthFactory = $defaults[static::KEY_FAILED_CUSTOM_UNAUTHENTICATED_FACTORY] ?? null;
        assert(
            $customUnAuthFactory === null ||
            $this->checkPublicStaticCallable(
                $customUnAuthFactory,
                [],
                ResponseInterface::class
            ),
            "Invalid custom factory."
        );

        $approvalUri = $defaults[static::KEY_APPROVAL_URI_STRING];
        assert(empty($approvalUri) === false, "Invalid Approval URI `$approvalUri`.");

        $errorUri = $defaults[static::KEY_ERROR_URI_STRING];
        assert(empty($errorUri) === false, "Invalid Error URI `$errorUri`.");

        $defaultClientId = $defaults[static::KEY_DEFAULT_CLIENT_ID];
        assert(empty($defaultClientId) === false, "Invalid Default Client ID `$defaultClientId`.");

        $userTable = $defaults[static::KEY_USER_TABLE_NAME];
        assert(empty($userTable) === false, "Invalid User Table Name `$userTable`.");

        $userPk = $defaults[static::KEY_USER_TABLE_NAME];
        assert(empty($userPk) === false, "Invalid User Primary Key Name `$userPk`.");

        return $defaults + [
                static::KEY_APPROVAL_URI_STRING              => $approvalUri,
                static::KEY_ERROR_URI_STRING                 => $errorUri,
                static::KEY_DEFAULT_CLIENT_ID                => $defaultClientId,
                static::KEY_USER_TABLE_NAME                  => $userTable,
                static::KEY_USER_PRIMARY_KEY_NAME            => $userPk,
                static::KEY_USER_CREDENTIALS_VALIDATOR       => $credentialsValidator,
                static::KEY_USER_SCOPE_VALIDATOR             => $scopeValidator,
                static::KEY_TOKEN_CUSTOM_PROPERTIES_PROVIDER => $customPropsProvider,
            ];
    }
430020
public static function pathsToPublish($provider = null, $group = null)
	{
		if ($group && array_key_exists($group, static::$publishGroups))
		{
			return static::$publishGroups[$group];
		}

		if ($provider && array_key_exists($provider, static::$publishes))
		{
			return static::$publishes[$provider];
		}

		if ($group || $provider)
		{
			return [];
		}

		$paths = [];

		foreach (static::$publishes as $class => $publish)
		{
			$paths = array_merge($paths, $publish);
		}

		return $paths;
	}
1126773
protected function providerExists($provider)
    {
        return (
            array_key_exists($provider, $this->serviceMap) ||
            array_key_exists($provider, $this->config)
        );
    }
640657
protected function getGlobPaths($path)
    {
        $paths = [];
        $iterator = new \GlobIterator($path);

        foreach ($iterator as $fileInfo) {
            /* @var $fileInfo \SplFileInfo */
            $paths[] = $fileInfo->getPathname();
        }

        // validate
        if (count($paths) === 0) {
            throw new InvalidConfigurationException("coverage_clover XML file is not readable: ${path}");
        }

        return $paths;
    }
17772
public function getProvider($provider)
    {
        $name = is_string($provider) ? $provider : get_class($provider);

        return Arr::first($this->serviceProviders, function ($key, $value) use ($name) {
            return $value instanceof $name;
        });
    }
1002833
public function registerProvider($provider)
    {
        if (($provider = $this->getProvider($provider))) {
        } elseif (is_string($provider)) {
            $provider = $this->resolveProvider($provider);
        }

        if ($this->registeredProvider($provider)) {
            return $provider;
        }

        if (method_exists($provider, 'register')) {
            $provider->register();
        }

        $this->markAsRegistered($provider);

        // If the application has already booted, we will call this boot method on
        // the provider class so it has an opportunity to do its boot logic and
        // will be ready for any usage by this developer's application logic.
        if ($this->booted) {
            $this->bootProvider($provider);
        }
        return $provider;
    }
690712
public function readConfig($path)
    {
        $jsonFile = new JsonFile($path);
        $config = $jsonFile->exists() ? $jsonFile->read() : [];
        foreach ($this->dependencies as $key) {
            if (!isset($config[$key])) {
                $config[$key] = [];
            }
        }
        return $config;
    }
1166610
public function ToDouble( $provider )
	{
		try
		{
			if ( is_null( $this->_doubleValue ) )
			{
				$this->_doubleValue = Convert::ToDouble( $this->Value, $provider );
			}
			return is_null( $this->_doubleValue ) ? null : (double)$this->_doubleValue;
		}
		catch ( FormatException $ex )
		{
			throw XPath2Exception::withErrorCodeAndParams("FORG0001", Resources::FORG0001, array( $this->Value, "xs:double") );
		}
	}
134840
public function ToByte( $provider )
	{
		try
		{
			return Convert::ToByte( $this->Value, $provider );
		}
		catch ( FormatException $ex )
		{
			throw XPath2Exception::withErrorCodeAndParams("FORG0001", Resources::FORG0001, array( $this->Value, "xs:unsignedByte") );
		}
	}