Yosymfony\Spress\Core\DataSource\Filesystem\AttributeParser::__construct PHP Method

__construct() public method

Constructor.
public __construct ( string $type = self::PARSER_YAML )
$type string Type of parser: "yaml" or "json"
    public function __construct($type = self::PARSER_YAML)
    {
        $locator = new FileLocator([]);
        $this->config = new Config([new YamlLoader($locator), new JsonLoader($locator)]);
        switch ($type) {
            case self::PARSER_YAML:
                $this->type = Config::TYPE_YAML;
                break;
            case self::PARSER_JSON:
                $this->type = Config::TYPE_JSON;
                break;
            default:
                throw new \RuntimeException(sprintf('Invalid attributte parser type: "%s".', $type));
        }
    }