Code Duplication    Length = 10-10 lines in 3 locations

lib/Doctrine/ODM/MongoDB/Aggregation/Stage/AbstractBucket.php 1 location

@@ 93-102 (lines=10) @@
90
     */
91
    abstract protected function getStageName();
92
93
    private function convertExpression($expression)
94
    {
95
        if (is_array($expression)) {
96
            return array_map([$this, 'convertExpression'], $expression);
97
        } elseif (is_string($expression) && substr($expression, 0, 1) === '$') {
98
            return '$' . $this->getDocumentPersister()->prepareFieldName(substr($expression, 1));
99
        } else {
100
            return Type::convertPHPToDatabaseValue(Expr::convertExpression($expression));
101
        }
102
    }
103
104
    /**
105
     * @return \Doctrine\ODM\MongoDB\Persisters\DocumentPersister

lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php 1 location

@@ 334-343 (lines=10) @@
331
        return $this;
332
    }
333
334
    private function convertExpression($expression)
335
    {
336
        if (is_array($expression)) {
337
            return array_map([$this, 'convertExpression'], $expression);
338
        } elseif (is_string($expression) && substr($expression, 0, 1) === '$') {
339
            return '$' . $this->getDocumentPersister($this->class)->prepareFieldName(substr($expression, 1));
340
        } else {
341
            return Type::convertPHPToDatabaseValue(Expr::convertExpression($expression));
342
        }
343
    }
344
345
    private function convertTargetFieldName($fieldName)
346
    {

lib/Doctrine/ODM/MongoDB/Aggregation/Stage/ReplaceRoot.php 1 location

@@ 64-73 (lines=10) @@
61
        ];
62
    }
63
64
    private function convertExpression($expression)
65
    {
66
        if (is_array($expression)) {
67
            return array_map([$this, 'convertExpression'], $expression);
68
        } elseif (is_string($expression) && substr($expression, 0, 1) === '$') {
69
            return '$' . $this->getDocumentPersister()->prepareFieldName(substr($expression, 1));
70
        } else {
71
            return Type::convertPHPToDatabaseValue(Expr::convertExpression($expression));
72
        }
73
    }
74
75
    /**
76
     * @return \Doctrine\ODM\MongoDB\Persisters\DocumentPersister