Code Duplication    Length = 38-38 lines in 2 locations

Serializer/JMSHandlerRegistry.php 1 location

@@ 24-61 (lines=38) @@
21
 *
22
 * @internal do not depend on this class directly
23
 */
24
class JMSHandlerRegistry implements HandlerRegistryInterface
25
{
26
    private $registry;
27
28
    public function __construct(HandlerRegistryInterface $registry)
29
    {
30
        $this->registry = $registry;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function registerSubscribingHandler(SubscribingHandlerInterface $handler)
37
    {
38
        return $this->registry->registerSubscribingHandler($handler);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function registerHandler($direction, $typeName, $format, $handler)
45
    {
46
        return $this->registry->registerHandler($direction, $typeName, $format, $handler);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getHandler($direction, $typeName, $format)
53
    {
54
        do {
55
            $handler = $this->registry->getHandler($direction, $typeName, $format);
56
            if (null !== $handler) {
57
                return $handler;
58
            }
59
        } while ($typeName = get_parent_class($typeName));
60
    }
61
}
62

Serializer/JMSHandlerRegistryV2.php 1 location

@@ 24-61 (lines=38) @@
21
 *
22
 * @internal do not depend on this class directly
23
 */
24
final class JMSHandlerRegistryV2 implements HandlerRegistryInterface
25
{
26
    private $registry;
27
28
    public function __construct(HandlerRegistryInterface $registry)
29
    {
30
        $this->registry = $registry;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function registerSubscribingHandler(SubscribingHandlerInterface $handler): void
37
    {
38
        $this->registry->registerSubscribingHandler($handler);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function registerHandler(int $direction, string $typeName, string $format, $handler): void
45
    {
46
        $this->registry->registerHandler($direction, $typeName, $format, $handler);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getHandler(int $direction, string $typeName, string $format)
53
    {
54
        do {
55
            $handler = $this->registry->getHandler($direction, $typeName, $format);
56
            if (null !== $handler) {
57
                return $handler;
58
            }
59
        } while ($typeName = get_parent_class($typeName));
60
    }
61
}
62