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.
@@ 224-241 (lines=18) @@
221
     *
222
     * @throws \Prophecy\Exception\InvalidArgumentException
223
     */
224
    public function should($prediction)
225
    {
226
        if (is_callable($prediction)) {
227
            $prediction = new Prediction\CallbackPrediction($prediction);
228
        }
229
230
        if (!$prediction instanceof Prediction\PredictionInterface) {
231
            throw new InvalidArgumentException(sprintf(
232
                'Expected callable or instance of PredictionInterface, but got %s.',
233
                gettype($prediction)
234
            ));
235
        }
236
237
        $this->bindToObjectProphecy();
238
        $this->prediction = $prediction;
239
240
        return $this;
241
    }
242
243
    /**
244
     * Sets call prediction to the prophecy.