src/Environaut/Config/ConfigHandler.php
protected function getReaderByExtension($location)
    {
        $ext = pathinfo($location, PATHINFO_EXTENSION);

        $reader = null;

        switch ($ext) {
            case 'json':
                $reader = new JsonConfigReader();
                break;
            case 'xml':
                $reader = new XmlConfigReader();
                break;
            case 'php':
                $reader = new PhpConfigReader();
                break;
            default:
                throw new \InvalidArgumentException(
                    'File could not be read: ' . $location . PHP_EOL .
                    'Supported config file extensions are: ' . implode(', ', $this->supported_file_extensions)
                );
                break;
        }

        return $reader;
    }
protected function getReaderByExtension($location)
    {
        $ext = pathinfo($location, PATHINFO_EXTENSION);

        $reader = null;

        switch ($ext) {
            case 'json':
                $reader = new JsonConfigReader();
                break;
            case 'xml':
                $reader = new XmlConfigReader();
                break;
            case 'php':
                $reader = new PhpConfigReader();
                break;
            default:
                throw new \InvalidArgumentException(
                    'File could not be read: ' . $location . PHP_EOL .
                    'Supported config file extensions are: ' . implode(', ', $this->supported_file_extensions)
                );
                break;
        }

        return $reader;
    }
Returns a specific reader instance depending on the file
extension of the given config file location.

@param string $location

@return IConfigReader

@throws \InvalidArgumentException in case of unsupported file extensions