PHP Class LdapTools\Schema\Parser\SchemaYamlParser

Author: Chad Sikorra ([email protected])
Inheritance: implements LdapTools\Schema\Parser\SchemaParserInterface
Show file Open project: ldaptools/ldaptools Class Usage Examples

Protected Properties

Property Type Description
$arrayToOp LdapTools\Utilities\ArrayToOperator
$defaultSchemaFolder The folder where the default schema files reside.
$optionMap array
$schemaFolder The folder where the schema files are located.
$schemas Schema names to their YAML mappings (ie. ['ad' => [ ]])

Public Methods

Method Description
__construct ( string $schemaFolder )
getSchemaModificationTime ( string $schemaName ) : DateTime Given the schema name, return the last time the schema was modified in DateTime format.
parse ( $schemaName, $objectType )
parseAll ( $schemaName )

Protected Methods

Method Description
cleanObjectArray ( array $schemaObject ) : array Removes certain keys so they don't get parsed again.
getExtendedDefaultSchemaObject ( array $objectSchema ) : array If we need to retrieve one of the default schemas, then it's probably the case that the schema folder path was manually defined. So retrieve the default schema object by parsing the name from the default folder path and then reset the schema folder back to what it originally was.
getObjectFromSchema ( array $schema, string $objectType ) : array Check for a specific object type in the schema and validate it.
getParentSchemaObject ( array $objectSchema, string $schemaName ) : array Determines what parent array object to get based on the directive used.
getSchemaFileName ( string $folder, string $schema ) : string Check for a YML file of the specified schema name and return the full path.
mergeAnyExtendedSchemas ( array $objectSchema, string $schemaName ) : array If the 'extends' option is given, then merge this schema object with the requested schema object.
mergeDefaultSchemaFile ( string $schemaName ) If the 'extends_default' directive is used, then merge the specified default schema.
mergeIncludedSchemas ( string $schemaName ) If the 'include' directive is used, then merge the specified schemas into the current one.
mergeSchemaObjectArrays ( array $parent, array $schema ) : array Performs the logic for merging one schema object array with another.
parseControls ( array $objectSchema ) : LdapControl[]
parseConverterMap ( array $objectSchema ) : array Parse the converters section of an object schema definition to generate the attribute converter map.
parseFilter ( LdapObjectSchema $objectSchema, array $objectArray ) : BaseOperator Get the filter for the schema object.
parseSchemaNameToArray ( string $schemaName ) Given a schema name, parse it into the array.
parseYamlForObject ( array $schema, string $schemaName, string $objectType ) : LdapObjectSchema Attempt to find the object type definition in the schema and create its object representation.
updateObjectArray ( string $schemaName, array $schemaObject ) Update the object in the schema array in case it extended a different object type.
validateObjectSchema ( LdapObjectSchema $schema ) Validate that an object schema meets the minimum requirements.
validateSchemaType ( LdapObjectSchema $schema, array $schemaArray ) Validates some of the schema values to check that they are allowed.

Method Details

__construct() public method

public __construct ( string $schemaFolder )
$schemaFolder string

cleanObjectArray() protected method

Removes certain keys so they don't get parsed again.
protected cleanObjectArray ( array $schemaObject ) : array
$schemaObject array
return array

getExtendedDefaultSchemaObject() protected method

If we need to retrieve one of the default schemas, then it's probably the case that the schema folder path was manually defined. So retrieve the default schema object by parsing the name from the default folder path and then reset the schema folder back to what it originally was.
protected getExtendedDefaultSchemaObject ( array $objectSchema ) : array
$objectSchema array
return array

getObjectFromSchema() protected method

Check for a specific object type in the schema and validate it.
protected getObjectFromSchema ( array $schema, string $objectType ) : array
$schema array
$objectType string
return array

getParentSchemaObject() protected method

Determines what parent array object to get based on the directive used.
protected getParentSchemaObject ( array $objectSchema, string $schemaName ) : array
$objectSchema array
$schemaName string
return array

getSchemaFileName() protected method

Check for a YML file of the specified schema name and return the full path.
protected getSchemaFileName ( string $folder, string $schema ) : string
$folder string
$schema string
return string

getSchemaModificationTime() public method

Given the schema name, return the last time the schema was modified in DateTime format.
public getSchemaModificationTime ( string $schemaName ) : DateTime
$schemaName string
return DateTime

mergeAnyExtendedSchemas() protected method

If the 'extends' option is given, then merge this schema object with the requested schema object.
protected mergeAnyExtendedSchemas ( array $objectSchema, string $schemaName ) : array
$objectSchema array
$schemaName string
return array

mergeDefaultSchemaFile() protected method

If the 'extends_default' directive is used, then merge the specified default schema.
protected mergeDefaultSchemaFile ( string $schemaName )
$schemaName string

mergeIncludedSchemas() protected method

If the 'include' directive is used, then merge the specified schemas into the current one.
protected mergeIncludedSchemas ( string $schemaName )
$schemaName string

mergeSchemaObjectArrays() protected method

Performs the logic for merging one schema object array with another.
protected mergeSchemaObjectArrays ( array $parent, array $schema ) : array
$parent array The parent schema object being extended.
$schema array The base schema object being defined.
return array

parse() public method

public parse ( $schemaName, $objectType )

parseAll() public method

public parseAll ( $schemaName )

parseControls() protected method

protected parseControls ( array $objectSchema ) : LdapControl[]
$objectSchema array
return LdapTools\Connection\LdapControl[]

parseConverterMap() protected method

Parse the converters section of an object schema definition to generate the attribute converter map.
protected parseConverterMap ( array $objectSchema ) : array
$objectSchema array
return array

parseFilter() protected method

Get the filter for the schema object.
protected parseFilter ( LdapObjectSchema $objectSchema, array $objectArray ) : BaseOperator
$objectSchema LdapTools\Schema\LdapObjectSchema
$objectArray array
return LdapTools\Query\Operator\BaseOperator

parseSchemaNameToArray() protected method

Given a schema name, parse it into the array.
protected parseSchemaNameToArray ( string $schemaName )
$schemaName string

parseYamlForObject() protected method

Attempt to find the object type definition in the schema and create its object representation.
protected parseYamlForObject ( array $schema, string $schemaName, string $objectType ) : LdapObjectSchema
$schema array
$schemaName string
$objectType string
return LdapTools\Schema\LdapObjectSchema

updateObjectArray() protected method

Update the object in the schema array in case it extended a different object type.
protected updateObjectArray ( string $schemaName, array $schemaObject )
$schemaName string
$schemaObject array

validateObjectSchema() protected method

Validate that an object schema meets the minimum requirements.
protected validateObjectSchema ( LdapObjectSchema $schema )
$schema LdapTools\Schema\LdapObjectSchema

validateSchemaType() protected method

Validates some of the schema values to check that they are allowed.
protected validateSchemaType ( LdapObjectSchema $schema, array $schemaArray )
$schema LdapTools\Schema\LdapObjectSchema
$schemaArray array

Property Details

$arrayToOp protected property

protected ArrayToOperator,LdapTools\Utilities $arrayToOp
return LdapTools\Utilities\ArrayToOperator

$defaultSchemaFolder protected property

The folder where the default schema files reside.
protected $defaultSchemaFolder

$optionMap protected property

protected array $optionMap
return array

$schemaFolder protected property

The folder where the schema files are located.
protected $schemaFolder

$schemas protected property

Schema names to their YAML mappings (ie. ['ad' => [ ]])
protected $schemas