RomaricDrigon\MetaYaml\MetaYaml::__construct PHP Method

__construct() public method

need to have a schema array
public __construct ( array $schema, $validate = false )
$schema array
    public function __construct(array $schema, $validate = false)
    {
        $this->schema = $schema;
        if (isset($this->schema['prefix'])) {
            $this->prefix = $this->schema['prefix'];
        }
        if ($validate) {
            // we validate the schema using the meta schema, defining the structure of our schema
            try {
                $this->validateSchema();
            } catch (\Exception $e) {
                throw new \Exception("Unable to validate schema with error: {$e->getMessage()}");
            }
        }
    }