1 | <?php |
||
20 | class MagicConstantTransformer extends BaseSourceTransformer |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * Root path of application |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected static $rootPath = ''; |
||
29 | |||
30 | /** |
||
31 | * Path to rewrite to (cache directory) |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | protected static $rewriteToPath = ''; |
||
36 | |||
37 | /** |
||
38 | * Class constructor |
||
39 | * |
||
40 | * @param AspectKernel $kernel Instance of kernel |
||
41 | */ |
||
42 | 6 | public function __construct(AspectKernel $kernel) |
|
48 | |||
49 | /** |
||
50 | * This method may transform the supplied source and return a new replacement for it |
||
51 | * |
||
52 | * @param StreamMetaData $metadata Metadata for source |
||
53 | * @return void|bool Return false if transformation should be stopped |
||
54 | */ |
||
55 | 5 | public function transform(StreamMetaData $metadata) |
|
84 | |||
85 | /** |
||
86 | * Resolves file name from the cache directory to the real application root dir |
||
87 | * |
||
88 | * @param string $fileName Absolute file name |
||
89 | * |
||
90 | * @return string Resolved file name |
||
91 | */ |
||
92 | 1 | public static function resolveFileName($fileName) |
|
100 | |||
101 | /** |
||
102 | * Replace only magic constants in the code |
||
103 | * |
||
104 | * @param StreamMetaData $metadata |
||
105 | */ |
||
106 | 3 | private function replaceMagicConstants(StreamMetaData $metadata) |
|
125 | } |
||
126 |