Code Duplication    Length = 10-11 lines in 2 locations

src/Moka/Plugin/PHPUnit/PHPUnitMockingStrategy.php 1 location

@@ 52-61 (lines=10) @@
49
     * @param Stub $stub
50
     * @return void
51
     */
52
    protected function doDecorate($mock, Stub $stub)
53
    {
54
        $methodName = $stub->getMethodName();
55
        $methodValue = $stub->getMethodValue();
56
57
        $partial = $mock->expects(new AnyInvokedCountMatcher())->method($methodName);
58
        $methodValue instanceof \Throwable
59
            ? $partial->willThrowException($methodValue)
60
            : $partial->willReturn($methodValue);
61
    }
62
63
    /**
64
     * @param MockObject $mock

src/Moka/Plugin/Prophecy/ProphecyMockingStrategy.php 1 location

@@ 49-59 (lines=11) @@
46
     * @param Stub $stub
47
     * @return void
48
     */
49
    protected function doDecorate($mock, Stub $stub)
50
    {
51
        $methodName = $stub->getMethodName();
52
        $methodValue = $stub->getMethodValue();
53
54
        /** @var MethodProphecy $partial */
55
        $partial = $mock->$methodName(new MaxPriorityToken());
56
        $methodValue instanceof \Throwable
57
            ? $partial->willThrow($methodValue)
58
            : $partial->willReturn($methodValue);
59
    }
60
61
    /**
62
     * @param object $mock