Code Duplication    Length = 16-21 lines in 2 locations

src/Prophecy/Doubler/LazyDouble.php 2 locations

@@ 51-66 (lines=16) @@
48
     * @throws \Prophecy\Exception\Doubler\ClassNotFoundException
49
     * @throws \Prophecy\Exception\Doubler\DoubleException
50
     */
51
    public function setParentClass($class)
52
    {
53
        if (null !== $this->double) {
54
            throw new DoubleException('Can not extend class with already instantiated double.');
55
        }
56
57
        if (!$class instanceof ReflectionClass) {
58
            if (!class_exists($class)) {
59
                throw new ClassNotFoundException(sprintf('Class %s not found.', $class), $class);
60
            }
61
62
            $class = new ReflectionClass($class);
63
        }
64
65
        $this->class = $class;
66
    }
67
68
    /**
69
     * Tells doubler to implement specific interface with double.
@@ 76-96 (lines=21) @@
73
     * @throws \Prophecy\Exception\Doubler\InterfaceNotFoundException
74
     * @throws \Prophecy\Exception\Doubler\DoubleException
75
     */
76
    public function addInterface($interface)
77
    {
78
        if (null !== $this->double) {
79
            throw new DoubleException(
80
                'Can not implement interface with already instantiated double.'
81
            );
82
        }
83
84
        if (!$interface instanceof ReflectionClass) {
85
            if (!interface_exists($interface)) {
86
                throw new InterfaceNotFoundException(
87
                    sprintf('Interface %s not found.', $interface),
88
                    $interface
89
                );
90
            }
91
92
            $interface = new ReflectionClass($interface);
93
        }
94
95
        $this->interfaces[] = $interface;
96
    }
97
98
    /**
99
     * Sets constructor arguments.