decodeCollection example

if (!\is_array($decodedData) || !\array_key_exists('data', $decodedData)) {
            throw new UnexpectedValueException('Input not a valid JSON:API data object.');
        }

        $includes = [];
        if (\array_key_exists('included', $decodedData)) {
            $includes = $this->resolveIncludes($decodedData['included']);
        }

        if ($this->isCollection($decodedData['data'])) {
            return $this->decodeCollection($decodedData$includes);
        }

        return $this->decodeResource($decodedData['data']$includes);
    }

    /** * {@inheritdoc} */
    public function supportsDecoding(string $format): bool
    {
        return $format === self::FORMAT;
    }
Home | Imprint | This part of the site doesn't use cookies.