This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
12
{
13
/**
14
* @var KernelWrapper
15
*/
16
private $kernel;
17
18
/**
19
* @var BundleFinder
20
*/
21
private $finder;
22
23
/**
24
* @var ClassAnalyzer
25
*/
26
private $analyzer;
27
28
/**
29
* @param KernelWrapper $kernel
30
* @param BundleFinder $finder
31
* @param ClassAnalyzer $analyzer
32
*/
33
public function __construct(KernelWrapper $kernel, BundleFinder $finder, ClassAnalyzer $analyzer)
34
{
35
$this->kernel = $kernel;
36
$this->finder = $finder;
37
$this->analyzer = $analyzer;
38
}
39
40
/**
41
* {@inheritdoc}
42
*/
43
public function buildDefinitions()
44
{
45
$definitions = [];
46
47
$twigExtensions = $this->finder->findClasses(
48
$this->kernel->getBundles(),
49
['Twig', 'Templating'],
50
'Twig_Extension'
51
);
52
53
foreach ($twigExtensions as $twigExtension) {
54
if (true === $this->analyzer->needConstruction($twigExtension)) {
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.