src/Hydra/Serializer/DocumentationNormalizer.php
private function getHydraOperations(string $resourceClass, ResourceMetadata $resourceMetadata, string $prefixedShortName, bool $collection): array
    {
        if (null === $operations = $collection ? $resourceMetadata->getCollectionOperations() : $resourceMetadata->getItemOperations()) {
            return [];
        }

        $hydraOperations = [];
        foreach ($operations as $operationName => $operation) {
            $hydraOperations[] = $this->getHydraOperation($resourceClass, $resourceMetadata, $operationName, $operation, $prefixedShortName, $collection ? OperationType::COLLECTION : OperationType::ITEM);
        }

        if (null !== $this->subresourceOperationFactory) {
            foreach ($this->subresourceOperationFactory->create($resourceClass) as $operationId => $operation) {
                $subresourceMetadata = $this->resourceMetadataFactory->create($operation['resource_class']);
                $propertyMetadata = $this->propertyMetadataFactory->create(end($operation['identifiers'])[1], $operation['property']);
                $hydraOperations[] = $this->getHydraOperation($resourceClass, $subresourceMetadata, $operation['route_name'], $operation, "#{$subresourceMetadata->getShortName()}", OperationType::SUBRESOURCE, $propertyMetadata->getSubresource());
            }
        }

        return $hydraOperations;
    }
private function getHydraOperations(string $resourceClass, ResourceMetadata $resourceMetadata, string $prefixedShortName, bool $collection): array
    {
        if (null === $operations = $collection ? $resourceMetadata->getCollectionOperations() : $resourceMetadata->getItemOperations()) {
            return [];
        }

        $hydraOperations = [];
        foreach ($operations as $operationName => $operation) {
            $hydraOperations[] = $this->getHydraOperation($resourceClass, $resourceMetadata, $operationName, $operation, $prefixedShortName, $collection ? OperationType::COLLECTION : OperationType::ITEM);
        }

        if (null !== $this->subresourceOperationFactory) {
            foreach ($this->subresourceOperationFactory->create($resourceClass) as $operationId => $operation) {
                $subresourceMetadata = $this->resourceMetadataFactory->create($operation['resource_class']);
                $propertyMetadata = $this->propertyMetadataFactory->create(end($operation['identifiers'])[1], $operation['property']);
                $hydraOperations[] = $this->getHydraOperation($resourceClass, $subresourceMetadata, $operation['route_name'], $operation, "#{$subresourceMetadata->getShortName()}", OperationType::SUBRESOURCE, $propertyMetadata->getSubresource());
            }
        }

        return $hydraOperations;
    }
private function getHydraOperations ( string $ resourceClass , ResourceMetadata $ resourceMetadata , string $ prefixedShortName , bool $ collection ) : array { if ( null === $ operations = $ collection ? $ resourceMetadata -> getCollectionOperations ( ) : $ resourceMetadata -> getItemOperations ( ) ) { return [ ] ; } $ hydraOperations = [ ] ; foreach ( $ operations as $ operationName => $ operation ) { $ hydraOperations [ ] = $ this -> getHydraOperation ( $ resourceClass , $ resourceMetadata , $ operationName , $ operation , $ prefixedShortName , $ collection ? OperationType :: COLLECTION : OperationType :: ITEM ) ; } if ( null !== $ this -> subresourceOperationFactory ) { foreach ( $ this -> subresourceOperationFactory -> create ( $ resourceClass ) as $ operationId => $ operation ) { $ subresourceMetadata = $ this -> resourceMetadataFactory -> create ( $ operation [ 'resource_class' ] ) ; $ propertyMetadata = $ this -> propertyMetadataFactory -> create ( end ( $ operation [ 'identifiers' ] ) [ 1 ] , $ operation [ 'property' ] ) ; $ hydraOperations [ ] = $ this -> getHydraOperation ( $ resourceClass , $ subresourceMetadata , $ operation [ 'route_name' ] , $ operation , "#{$subresourceMetadata->getShortName()}" , OperationType :: SUBRESOURCE , $ propertyMetadata -> getSubresource ( ) ) ; } } return $ hydraOperations ; }
Gets Hydra operations.
Gets Hydra operations .