Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 321-335 (lines=15) @@
318
     * @throws \BadMethodCallException If the query does not already have $text criteria.
319
     *
320
     */
321
    public function caseSensitive($caseSensitive)
322
    {
323
        if (! isset($this->query['$text'])) {
324
            throw new \BadMethodCallException('This method requires a $text operator (call text() first)');
325
        }
326
327
        // Remove caseSensitive option to keep support for older database versions
328
        if ($caseSensitive) {
329
            $this->query['$text']['$caseSensitive'] = true;
330
        } elseif (isset($this->query['$text']['$caseSensitive'])) {
331
            unset($this->query['$text']['$caseSensitive']);
332
        }
333
334
        return $this;
335
    }
336
337
    /**
338
     * Associates a comment to any expression taking a query predicate.
@@ 384-398 (lines=15) @@
381
     * @throws \BadMethodCallException If the query does not already have $text criteria.
382
     *
383
     */
384
    public function diacriticSensitive($diacriticSensitive)
385
    {
386
        if (! isset($this->query['$text'])) {
387
            throw new \BadMethodCallException('This method requires a $text operator (call text() first)');
388
        }
389
390
        // Remove diacriticSensitive option to keep support for older database versions
391
        if ($diacriticSensitive) {
392
            $this->query['$text']['$diacriticSensitive'] = true;
393
        } elseif (isset($this->query['$text']['$diacriticSensitive'])) {
394
            unset($this->query['$text']['$diacriticSensitive']);
395
        }
396
397
        return $this;
398
    }
399
400
    /**
401
     * Add $each criteria to the expression for a $push operation.