LdapTools\Schema\Parser\SchemaYamlParser::mergeSchemaObjectArrays PHP Method

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
    protected function mergeSchemaObjectArrays($parent, $schema)
    {
        // Directives used that exist in the schema being extended, that are arrays, should be merged.
        foreach (array_intersect_key($schema, $parent) as $key => $value) {
            if (is_array($value)) {
                $schema[$key] = array_merge_recursive($parent[$key], $value);
            }
        }
        // Directives in the parent that have not been defined should be added.
        return array_replace($schema, array_diff_key($parent, $schema));
    }