1 | <?php |
||
13 | class ScssAssetConverter extends Component implements AssetConverterInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var Storage |
||
17 | */ |
||
18 | public $storage; |
||
19 | |||
20 | /** |
||
21 | * @var boolean whether the source asset file should be converted even if |
||
22 | * its result already exists. You may want to set this to be `true` during |
||
23 | * the development stage to make sure the converted assets are always up-to- |
||
24 | * date. Do not set this to true on production servers as it will |
||
25 | * significantly degrade the performance. |
||
26 | */ |
||
27 | public $forceConvert = false; |
||
28 | |||
29 | public $formatter = null; |
||
30 | |||
31 | 11 | protected $scssPhpFormatterMap = |
|
32 | [ |
||
33 | 11 | 'compact' => '\Leafo\ScssPhp\Formatter\Compact', |
|
34 | 11 | 'compressed' => '\Leafo\ScssPhp\Formatter\Compressed', |
|
35 | 1 | 'crunched' => '\Leafo\ScssPhp\Formatter\Crunched', |
|
36 | 'debug' => '\Leafo\ScssPhp\Formatter\Debug', |
||
37 | 11 | 'expanded' => '\Leafo\ScssPhp\Formatter\Expanded', |
|
38 | 11 | 'nested' => '\Leafo\ScssPhp\Formatter\Nested', |
|
39 | ]; |
||
40 | |||
41 | protected $defaultFormatter = 'nested'; |
||
42 | |||
43 | protected $compiler; |
||
44 | |||
45 | public function init() |
||
55 | 8 | ||
56 | /** |
||
57 | 8 | * Converts a given SCSS asset file into a CSS file. |
|
58 | * @param string $asset the asset file path, relative to $basePath |
||
59 | 8 | * @param string $basePath the directory the $asset is relative to. |
|
60 | 1 | * @return string the converted asset file path, relative to $basePath. |
|
61 | 1 | */ |
|
62 | public function convert($asset, $basePath) |
||
84 | 6 | ||
85 | protected function getExtension(string $filename): string |
||
89 | |||
90 | 7 | protected function replaceExtension(string $filename, string $newExtension): string |
|
95 | |||
96 | protected function convertAndSaveIfNeeded(string $inFile, string $outFile) |
||
103 | |||
104 | 3 | protected function shouldConvert(string $inFile, string $outFile): bool |
|
119 | |||
120 | protected function isOlder(string $fileA, string $fileB): bool |
||
124 | |||
125 | protected function getScssPhpFormatterClass($formatter): string |
||
137 | } |
||
138 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.