Raml\Parser::recurseAndParseSchemas PHP Method

recurseAndParseSchemas() private method

Recurses though resources and replaces schema strings
private recurseAndParseSchemas ( array $array, string $rootDir ) : array
$array array
$rootDir string
return array
    private function recurseAndParseSchemas($array, $rootDir)
    {
        foreach ($array as $key => &$value) {
            if (is_array($value)) {
                if (isset($value['schema'])) {
                    if (in_array($key, array_keys($this->schemaParsers))) {
                        $schemaParser = $this->schemaParsers[$key];
                        $fileDir = $this->getCachedFilePath($value['schema']);
                        $schemaParser->setSourceUri('file:' . ($fileDir ? $fileDir : $rootDir . DIRECTORY_SEPARATOR));
                        $value['schema'] = $schemaParser->createSchemaDefinition($value['schema']);
                    } else {
                        throw new InvalidSchemaTypeException($key);
                    }
                } else {
                    $value = $this->recurseAndParseSchemas($value, $rootDir);
                }
            }
        }
        return $array;
    }