ApiPlatform\Core\Metadata\Extractor\YamlExtractor::extractResources PHP Метод

extractResources() приватный метод

private extractResources ( array $resourcesYaml, string $path )
$resourcesYaml array
$path string
    private function extractResources(array $resourcesYaml, string $path)
    {
        foreach ($resourcesYaml as $resourceName => $resourceYaml) {
            if (null === $resourceYaml) {
                $resourceYaml = [];
            }
            if (!is_array($resourceYaml)) {
                throw new InvalidArgumentException(sprintf('"%s" setting is expected to be null or an array, %s given in "%s".', $resourceName, gettype($resourceYaml), $path));
            }
            $this->resources[$resourceName] = ['shortName' => $this->phpize($resourceYaml, 'shortName', 'string'), 'description' => $this->phpize($resourceYaml, 'description', 'string'), 'iri' => $this->phpize($resourceYaml, 'iri', 'string'), 'itemOperations' => $resourceYaml['itemOperations'] ?? null, 'collectionOperations' => $resourceYaml['collectionOperations'] ?? null, 'attributes' => $resourceYaml['attributes'] ?? null];
            if (!isset($resourceYaml['properties'])) {
                $this->resources[$resourceName]['properties'] = null;
                continue;
            }
            if (!is_array($resourceYaml['properties'])) {
                throw new InvalidArgumentException(sprintf('"properties" setting is expected to be null or an array, %s given in "%s".', gettype($resourceYaml['properties']), $path));
            }
            $this->extractProperties($resourceYaml, $resourceName, $path);
        }
    }