Code Duplication    Length = 15-15 lines in 2 locations

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

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