Code Duplication    Length = 9-11 lines in 2 locations

Promise/PromiseDeferred.php 2 locations

@@ 36-46 (lines=11) @@
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onNotify = null)
37
    {
38
        if ($this->state()->equals(State::PENDING())) {
39
            $resolver = new ThenResolver($onFulfilled, $onRejected, $onNotify);
40
            $this->resolvers[] = $resolver;
41
42
            return $resolver->promise();
43
        }
44
45
        return $this->actual->then($onFulfilled, $onRejected, $onNotify);
46
    }
47
48
    /**
49
     * {@inheritdoc}
@@ 51-59 (lines=9) @@
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onNotify = null)
52
    {
53
        if ($this->state()->equals(State::PENDING())) {
54
            $resolver = new DoneResolver($onFulfilled, $onRejected, $onNotify);
55
            $this->resolvers[] = $resolver;
56
        } else {
57
            $this->actual->done($onFulfilled, $onRejected, $onNotify);
58
        }
59
    }
60
61
    /**
62
     * {@inheritdoc}