Code Duplication    Length = 15-15 lines in 2 locations

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

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