Code Duplication    Length = 5-5 lines in 2 locations

src/Arrayy.php 1 location

@@ 3055-3059 (lines=5) @@
3052
        $jsonObject = \json_decode($json, false);
3053
3054
        $mapper = new \Arrayy\Mapper\Json();
3055
        $mapper->undefinedPropertyHandler = static function ($object, $key, $jsonValue) use ($class) {
3056
            if ($class->checkPropertiesMismatchInConstructor) {
3057
                throw new \TypeError('Property mismatch - input: ' . \print_r(['key' => $key, 'jsonValue' => $jsonValue], true) . ' for object: ' . \get_class($object));
3058
            }
3059
        };
3060
3061
        return $mapper->map($jsonObject, $class);
3062
    }

src/Collection/AbstractCollection.php 1 location

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