Code Duplication    Length = 12-12 lines in 2 locations

src/EventListener/InvalidationListener.php 1 location

@@ 231-242 (lines=12) @@
228
        }
229
    }
230
231
    private function getExpressionLanguage(): ExpressionLanguage
232
    {
233
        if (!$this->expressionLanguage) {
234
            // the expression comes from controller annotations, we can't detect whether they use expressions while building the configuration
235
            if (!class_exists(ExpressionLanguage::class)) {
236
                throw new \RuntimeException('Invalidation rules with expressions require '.ExpressionLanguage::class.' to be available.');
237
            }
238
            $this->expressionLanguage = new ExpressionLanguage();
239
        }
240
241
        return $this->expressionLanguage;
242
    }
243
}
244

src/EventListener/TagListener.php 1 location

@@ 179-190 (lines=12) @@
176
        return $this->getExpressionLanguage()->evaluate($expression, $values);
177
    }
178
179
    private function getExpressionLanguage(): ExpressionLanguage
180
    {
181
        if (!$this->expressionLanguage) {
182
            // the expression comes from controller annotations, we can't detect whether they use expressions while building the configuration
183
            if (!class_exists(ExpressionLanguage::class)) {
184
                throw new \RuntimeException('Using the tag annotation requires the '.ExpressionLanguage::class.' to be available.');
185
            }
186
            $this->expressionLanguage = new ExpressionLanguage();
187
        }
188
189
        return $this->expressionLanguage;
190
    }
191
}
192