Code Duplication    Length = 7-8 lines in 3 locations

src/Serializers/Hateoas/Normalizer/RelationCollectionObjectNormalizer.php 1 location

@@ 40-47 (lines=8) @@
37
     */
38
    public function normalize($object, $format = null, array $context = []): array
39
    {
40
        if (!$object instanceof RelationCollection && !$object instanceof ActionCollection) {
41
            throw new \InvalidArgumentException(\sprintf(
42
                'The normalizer support only "%s" or "%s" but "%s" given.',
43
                RelationCollection::class,
44
                ActionCollection::class,
45
                \is_object($object) ? \get_class($object) : \gettype($object)
46
            ));
47
        }
48
49
        $data = [];
50

src/Serializers/Hateoas/Normalizer/RelationObjectNormalizer.php 1 location

@@ 34-41 (lines=8) @@
31
     */
32
    public function normalize($object, $format = null, array $context = []): array
33
    {
34
        if (!$object instanceof RelationInterface && !$object instanceof ActionInterface) {
35
            throw new \InvalidArgumentException(\sprintf(
36
                'The normalizer support only "%s" or "%s" but "%s" given.',
37
                RelationInterface::class,
38
                ActionInterface::class,
39
                \is_object($object) ? \get_class($object) : \gettype($object)
40
            ));
41
        }
42
43
        $data = [
44
            'href' => $object->getHref()->getPath(),

src/Serializers/Hateoas/Normalizer/ResourceCollectionObjectNormalizer.php 1 location

@@ 39-45 (lines=7) @@
36
     */
37
    public function normalize($object, $format = null, array $context = [])
38
    {
39
        if (!$object instanceof ResourceCollection) {
40
            throw new \InvalidArgumentException(\sprintf(
41
                'The normalizer support only "%s" but "%s" given.',
42
                ResourceCollection::class,
43
                \is_object($object) ? \get_class($object) : \gettype($object)
44
            ));
45
        }
46
47
        $data = [];
48
        $links = [];