Code Duplication    Length = 19-19 lines in 2 locations

src/Promise/PromiseCancelled.php 1 location

@@ 76-94 (lines=19) @@
73
     * @override
74
     * @inheritDoc
75
     */
76
    public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null)
77
    {
78
        if (null === $onCancel)
79
        {
80
            $this->throwError($this->getReason());
81
        }
82
83
        $result = $onCancel($this->getReason());
84
85
        if ($result instanceof self)
86
        {
87
            $this->throwError($result->getReason());
88
        }
89
90
        if ($result instanceof PromiseInterface)
91
        {
92
            $result->done();
93
        }
94
    }
95
96
    /**
97
     * @override

src/Promise/PromiseRejected.php 1 location

@@ 71-89 (lines=19) @@
68
     * @override
69
     * @inheritDoc
70
     */
71
    public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null)
72
    {
73
        if (null === $onRejected)
74
        {
75
            $this->throwError($this->getReason());
76
        }
77
78
        $result = $onRejected($this->getReason());
79
80
        if ($result instanceof self)
81
        {
82
            $this->throwError($result->getReason());
83
        }
84
85
        if ($result instanceof PromiseInterface)
86
        {
87
            $result->done();
88
        }
89
    }
90
91
    /**
92
     * @override