Code Duplication    Length = 5-5 lines in 2 locations

src/Arrayy.php 1 location

@@ 3112-3116 (lines=5) @@
3109
        $jsonObject = \json_decode($json, false);
3110
3111
        $mapper = new \Arrayy\Mapper\Json();
3112
        $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) {
3113
            if ($class->checkPropertiesMismatchInConstructor) {
3114
                throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object));
3115
            }
3116
        };
3117
3118
        return $mapper->map($jsonObject, $class);
3119
    }

src/Collection/AbstractCollection.php 1 location

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