Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 326-340 (lines=15) @@
323
     *
324
     * @since 1.3
325
     */
326
    public function caseSensitive($caseSensitive)
327
    {
328
        if ( ! isset($this->query['$text'])) {
329
            throw new \BadMethodCallException('This method requires a $text operator (call text() first)');
330
        }
331
332
        // Remove caseSensitive option to keep support for older database versions
333
        if ($caseSensitive) {
334
            $this->query['$text']['$caseSensitive'] = true;
335
        } elseif (isset($this->query['$text']['$caseSensitive'])) {
336
            unset($this->query['$text']['$caseSensitive']);
337
        }
338
339
        return $this;
340
    }
341
342
    /**
343
     * Associates a comment to any expression taking a query predicate.
@@ 390-404 (lines=15) @@
387
     *
388
     * @since 1.3
389
     */
390
    public function diacriticSensitive($diacriticSensitive)
391
    {
392
        if ( ! isset($this->query['$text'])) {
393
            throw new \BadMethodCallException('This method requires a $text operator (call text() first)');
394
        }
395
396
        // Remove diacriticSensitive option to keep support for older database versions
397
        if ($diacriticSensitive) {
398
            $this->query['$text']['$diacriticSensitive'] = true;
399
        } elseif (isset($this->query['$text']['$diacriticSensitive'])) {
400
            unset($this->query['$text']['$diacriticSensitive']);
401
        }
402
403
        return $this;
404
    }
405
406
    /**
407
     * Add $each criteria to the expression for a $push operation.