Code Duplication    Length = 5-5 lines in 2 locations

src/Arrayy.php 1 location

@@ 3132-3136 (lines=5) @@
3129
        $jsonObject = \json_decode($json, false);
3130
3131
        $mapper = new \Arrayy\Mapper\Json();
3132
        $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) {
3133
            if ($class->checkPropertiesMismatchInConstructor) {
3134
                throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object));
3135
            }
3136
        };
3137
3138
        return $mapper->map($jsonObject, $class);
3139
    }

src/Collection/AbstractCollection.php 1 location

@@ 299-303 (lines=5) @@
296
        $return = static::create();
297
        $jsonObject = \json_decode($json, false);
298
        $mapper = new \Arrayy\Mapper\Json();
299
        $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($return) {
300
            if ($return->checkForMissingPropertiesInConstructor) {
301
                throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object));
302
            }
303
        };
304
305
        $type = $return->getType();
306