Code Duplication    Length = 15-15 lines in 2 locations

lib/Doctrine/ODM/MongoDB/Query/Expr.php 2 locations

@@ 304-318 (lines=15) @@
301
     *
302
     * @since 1.3
303
     */
304
    public function caseSensitive($caseSensitive)
305
    {
306
        if ( ! isset($this->query['$text'])) {
307
            throw new \BadMethodCallException('This method requires a $text operator (call text() first)');
308
        }
309
310
        // Remove caseSensitive option to keep support for older database versions
311
        if ($caseSensitive) {
312
            $this->query['$text']['$caseSensitive'] = true;
313
        } elseif (isset($this->query['$text']['$caseSensitive'])) {
314
            unset($this->query['$text']['$caseSensitive']);
315
        }
316
317
        return $this;
318
    }
319
320
    /**
321
     * Associates a comment to any expression taking a query predicate.
@@ 368-382 (lines=15) @@
365
     *
366
     * @since 1.3
367
     */
368
    public function diacriticSensitive($diacriticSensitive)
369
    {
370
        if ( ! isset($this->query['$text'])) {
371
            throw new \BadMethodCallException('This method requires a $text operator (call text() first)');
372
        }
373
374
        // Remove diacriticSensitive option to keep support for older database versions
375
        if ($diacriticSensitive) {
376
            $this->query['$text']['$diacriticSensitive'] = true;
377
        } elseif (isset($this->query['$text']['$diacriticSensitive'])) {
378
            unset($this->query['$text']['$diacriticSensitive']);
379
        }
380
381
        return $this;
382
    }
383
384
    /**
385
     * Add $each criteria to the expression for a $push operation.