src/Api/FormatsProvider.php
private function getOperationFormats(array $annotationFormats): array
    {
        $resourceFormats = [];
        foreach ($annotationFormats as $format => $value) {
            if (!is_numeric($format)) {
                $resourceFormats[$format] = (array) $value;
                continue;
            }
            if (!\is_string($value)) {
                throw new InvalidArgumentException(sprintf("The 'formats' attributes value must be a string when trying to include an already configured format, %s given.", \gettype($value)));
            }
            if (\array_key_exists($value, $this->configuredFormats)) {
                $resourceFormats[$value] = $this->configuredFormats[$value];
                continue;
            }

            throw new InvalidArgumentException(sprintf("You either need to add the format '%s' to your project configuration or declare a mime type for it in your annotation.", $value));
        }

        return $resourceFormats;
    }
private function getOperationFormats(array $annotationFormats): array
    {
        $resourceFormats = [];
        foreach ($annotationFormats as $format => $value) {
            if (!is_numeric($format)) {
                $resourceFormats[$format] = (array) $value;
                continue;
            }
            if (!\is_string($value)) {
                throw new InvalidArgumentException(sprintf("The 'formats' attributes value must be a string when trying to include an already configured format, %s given.", \gettype($value)));
            }
            if (\array_key_exists($value, $this->configuredFormats)) {
                $resourceFormats[$value] = $this->configuredFormats[$value];
                continue;
            }

            throw new InvalidArgumentException(sprintf("You either need to add the format '%s' to your project configuration or declare a mime type for it in your annotation.", $value));
        }

        return $resourceFormats;
    }
private function getOperationFormats ( array $ annotationFormats ) : array { $ resourceFormats = [ ] ; foreach ( $ annotationFormats as $ format => $ value ) { if ( ! is_numeric ( $ format ) ) { $ resourceFormats [ $ format ] = ( array ) $ value ; continue ; } if ( ! \ is_string ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( "The 'formats' attributes value must be a string when trying to include an already configured format, %s given." , \ gettype ( $ value ) ) ) ; } if ( \ array_key_exists ( $ value , $ this -> configuredFormats ) ) { $ resourceFormats [ $ value ] = $ this -> configuredFormats [ $ value ] ; continue ; } throw new InvalidArgumentException ( sprintf ( "You either need to add the format '%s' to your project configuration or declare a mime type for it in your annotation." , $ value ) ) ; } return $ resourceFormats ; }
Filter and populate the acceptable formats.

@throws InvalidArgumentException
Filter and populate the acceptable formats .