|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace DneCustomJsCss\Services; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\DBAL\Connection; |
|
|
|
|
|
|
6
|
|
|
use Shopware\Components\Theme\LessCompiler; |
|
|
|
|
|
|
7
|
|
|
use Shopware\Models\Shop\Shop; |
|
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
class LessCompilerDecorator implements LessCompiler |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* @var LessCompiler |
|
13
|
|
|
*/ |
|
14
|
|
|
private $compiler; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @var \Less_Parser |
|
|
|
|
|
|
18
|
|
|
*/ |
|
19
|
|
|
private $parser; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var Connection |
|
23
|
|
|
*/ |
|
24
|
|
|
private $connection; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var Shop |
|
28
|
|
|
*/ |
|
29
|
|
|
private $shop; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* LessCompilerDecorator constructor. |
|
33
|
|
|
* |
|
34
|
|
|
* @param LessCompiler $compiler |
|
35
|
|
|
* @param \Less_Parser $parser |
|
36
|
|
|
* @param Connection $connection |
|
37
|
|
|
*/ |
|
38
|
|
|
public function __construct( |
|
39
|
|
|
LessCompiler $compiler, |
|
40
|
|
|
\Less_Parser $parser, |
|
41
|
|
|
Connection $connection |
|
42
|
|
|
) { |
|
43
|
|
|
$this->compiler = $compiler; |
|
44
|
|
|
$this->parser = $parser; |
|
45
|
|
|
$this->connection = $connection; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @param Shop $shop |
|
50
|
|
|
*/ |
|
51
|
|
|
public function setShop(Shop $shop) |
|
52
|
|
|
{ |
|
53
|
|
|
$this->shop = $shop; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* {@inheritdoc} |
|
58
|
|
|
*/ |
|
59
|
|
|
public function setConfiguration(array $configuration) |
|
60
|
|
|
{ |
|
61
|
|
|
$this->compiler->setConfiguration($configuration); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* {@inheritdoc} |
|
66
|
|
|
*/ |
|
67
|
|
|
public function setImportDirectories(array $directories) |
|
68
|
|
|
{ |
|
69
|
|
|
$this->compiler->setImportDirectories($directories); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* {@inheritdoc} |
|
74
|
|
|
*/ |
|
75
|
|
|
public function setVariables(array $variables) |
|
76
|
|
|
{ |
|
77
|
|
|
$this->compiler->setVariables($variables); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* {@inheritdoc} |
|
82
|
|
|
*/ |
|
83
|
|
|
public function compile($file, $url) |
|
84
|
|
|
{ |
|
85
|
|
|
$this->compiler->compile($file, $url); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* {@inheritdoc} |
|
90
|
|
|
*/ |
|
91
|
|
|
public function get() |
|
92
|
|
|
{ |
|
93
|
|
|
$qb = $this->connection->createQueryBuilder(); |
|
94
|
|
|
$qb->select( |
|
95
|
|
|
['css'] |
|
96
|
|
|
) |
|
97
|
|
|
->from('dne_custom_js_css') |
|
98
|
|
|
->where('active = 1') |
|
99
|
|
|
->andWhere('FIND_IN_SET(:shopId, shopIds)') |
|
100
|
|
|
->setParameter('shopId', $this->shop->getId()) |
|
101
|
|
|
->orderBy('name', 'asc'); |
|
102
|
|
|
|
|
103
|
|
|
$styles = $qb->execute()->fetchAll(\PDO::FETCH_COLUMN); |
|
104
|
|
|
|
|
105
|
|
|
foreach ($styles as $style) { |
|
106
|
|
|
$this->parser->parse($style); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
return $this->compiler->get(); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* {@inheritdoc} |
|
114
|
|
|
*/ |
|
115
|
|
|
public function reset() |
|
116
|
|
|
{ |
|
117
|
|
|
$this->compiler->reset(); |
|
118
|
|
|
} |
|
119
|
|
|
} |
|
120
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths