Code Duplication    Length = 15-15 lines in 2 locations

src/RetryMiddleware.php 2 locations

@@ 73-87 (lines=15) @@
70
            );
71
    }
72
73
    private function onFulfilled(RequestInterface $req, array $options)
74
    {
75
        return function ($value) use ($req, $options) {
76
            if (!call_user_func(
77
                $this->decider,
78
                $options['retries'],
79
                $req,
80
                $value,
81
                null
82
            )) {
83
                return $value;
84
            }
85
            return $this->doRetry($req, $options);
86
        };
87
    }
88
89
    private function onRejected(RequestInterface $req, array $options)
90
    {
@@ 89-103 (lines=15) @@
86
        };
87
    }
88
89
    private function onRejected(RequestInterface $req, array $options)
90
    {
91
        return function ($reason) use ($req, $options) {
92
            if (!call_user_func(
93
                $this->decider,
94
                $options['retries'],
95
                $req,
96
                null,
97
                $reason
98
            )) {
99
                return new RejectedPromise($reason);
100
            }
101
            return $this->doRetry($req, $options);
102
        };
103
    }
104
105
    private function doRetry(RequestInterface $request, array $options)
106
    {