Code Duplication    Length = 18-18 lines in 2 locations

src/Prophecy/Prophecy/MethodProphecy.php 2 locations

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