Code Duplication    Length = 15-15 lines in 2 locations

src/FulfilledPromise.php 1 location

@@ 27-41 (lines=15) @@
24
        $this->value = $value;
25
    }
26
27
    public function then(
28
        callable $onFulfilled = null,
29
        callable $onRejected = null,
30
        callable $onProgress = null
31
    ) : PromiseInterface {
32
        if (null === $onFulfilled) {
33
            return $this;
34
        }
35
36
        try {
37
            return resolve($onFulfilled($this->value));
38
        } catch (\Exception $exception) {
39
            return new RejectedPromise($exception);
40
        }
41
    }
42
43
    public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
44
    {

src/RejectedPromise.php 1 location

@@ 29-43 (lines=15) @@
26
        $this->reason = $reason;
27
    }
28
29
    public function then(
30
        callable $onFulfilled = null,
31
        callable $onRejected = null,
32
        callable $onProgress = null
33
    ) : PromiseInterface {
34
        if (null === $onRejected) {
35
            return $this;
36
        }
37
38
        try {
39
            return resolve($onRejected($this->reason));
40
        } catch (\Exception $exception) {
41
            return new RejectedPromise($exception);
42
        }
43
    }
44
45
    public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
46
    {