Code Duplication    Length = 10-10 lines in 3 locations

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

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

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

@@ 48-57 (lines=10) @@
45
        ];
46
    }
47
48
    private function convertExpression($expression)
49
    {
50
        if (is_array($expression)) {
51
            return array_map([$this, 'convertExpression'], $expression);
52
        } elseif (is_string($expression) && substr($expression, 0, 1) === '$') {
53
            return '$' . $this->getDocumentPersister()->prepareFieldName(substr($expression, 1));
54
        }
55
56
        return Type::convertPHPToDatabaseValue(Expr::convertExpression($expression));
57
    }
58
59
    /**
60
     * @return DocumentPersister

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

@@ 300-309 (lines=10) @@
297
        return $this;
298
    }
299
300
    private function convertExpression($expression)
301
    {
302
        if (is_array($expression)) {
303
            return array_map([$this, 'convertExpression'], $expression);
304
        } elseif (is_string($expression) && substr($expression, 0, 1) === '$') {
305
            return '$' . $this->getDocumentPersister($this->class)->prepareFieldName(substr($expression, 1));
306
        }
307
308
        return Type::convertPHPToDatabaseValue(Expr::convertExpression($expression));
309
    }
310
311
    private function convertTargetFieldName($fieldName)
312
    {