Code Duplication    Length = 18-18 lines in 2 locations

src/Prophecy/Prophecy/MethodProphecy.php 2 locations

@@ 145-162 (lines=18) @@
142
     *
143
     * @throws \Prophecy\Exception\InvalidArgumentException
144
     */
145
    public function will($promise)
146
    {
147
        if (is_callable($promise)) {
148
            $promise = new Promise\CallbackPromise($promise);
149
        }
150
151
        if (!$promise instanceof Promise\PromiseInterface) {
152
            throw new InvalidArgumentException(sprintf(
153
                'Expected callable or instance of PromiseInterface, but got %s.',
154
                gettype($promise)
155
            ));
156
        }
157
158
        $this->bindToObjectProphecy();
159
        $this->promise = $promise;
160
161
        return $this;
162
    }
163
164
    /**
165
     * Sets return promise to the prophecy.
@@ 221-238 (lines=18) @@
218
     *
219
     * @throws \Prophecy\Exception\InvalidArgumentException
220
     */
221
    public function should($prediction)
222
    {
223
        if (is_callable($prediction)) {
224
            $prediction = new Prediction\CallbackPrediction($prediction);
225
        }
226
227
        if (!$prediction instanceof Prediction\PredictionInterface) {
228
            throw new InvalidArgumentException(sprintf(
229
                'Expected callable or instance of PredictionInterface, but got %s.',
230
                gettype($prediction)
231
            ));
232
        }
233
234
        $this->bindToObjectProphecy();
235
        $this->prediction = $prediction;
236
237
        return $this;
238
    }
239
240
    /**
241
     * Sets call prediction to the prophecy.