Code Duplication    Length = 15-15 lines in 2 locations

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

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