Class Schema
A JSON schema.
Used to validate other JSON files.
Methods summary
public static
read_json( $pathname
)
public
__construct( string $pathname
)
public
validate( mixed $data
, string $pathname
)
: boolean
Validate some data against the schema.
Validate some data against the schema.
Parameters
$data
- Data to validate.
$pathname
- The pathname to the file where the data is defined.
Returns
boolean
true
if the data is valid.
Throws
Exception
when the data is not valid.
public
validate_file( string $pathname
)
: boolean
Validate a JSON file against the schema.
Validate a JSON file against the schema.
Parameters
$pathname
- The pathname to the JSON file to validate.
Returns
boolean
See
Properties summary
protected
$schema
: mixed
protected
$validator
: JsonSchema\Validator