1 | <?php |
||
24 | class AopComposerManipulator |
||
25 | { |
||
26 | /** |
||
27 | * List of packages to exclude from analysis |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | public static $excludedPackages = [ |
||
32 | 'Dissect' => true, |
||
33 | 'Doctrine\\Common\Lexer\\' => true, |
||
34 | 'Doctrine\\Common\\Annotations\\' => true, |
||
35 | 'Go\\' => true, |
||
36 | 'Go\\ParserReflection\\' => true, |
||
37 | 'PhpParser\\' => true |
||
38 | ]; |
||
39 | |||
40 | /** |
||
41 | * Instance of original autoloader |
||
42 | * |
||
43 | * @var ClassLoader |
||
44 | */ |
||
45 | protected $original = null; |
||
46 | |||
47 | /** |
||
48 | * AOP kernel options |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $options = []; |
||
53 | |||
54 | /** |
||
55 | * File enumerator |
||
56 | * |
||
57 | * @var Enumerator |
||
58 | */ |
||
59 | protected $fileEnumerator; |
||
60 | |||
61 | /** |
||
62 | * Cache state |
||
63 | * |
||
64 | * @var array |
||
65 | */ |
||
66 | private $cacheState; |
||
67 | |||
68 | /** |
||
69 | * Constructs an wrapper for the composer loader |
||
70 | * |
||
71 | * @param ClassLoader $original Instance of current loader |
||
72 | * @param AspectContainer $container Instance of the container |
||
73 | * @param array $options Configuration options |
||
74 | */ |
||
75 | public function __construct(ClassLoader $original, AspectContainer $container, array $options = []) |
||
83 | |||
84 | /** |
||
85 | * Initialize aspect autoloader |
||
86 | * |
||
87 | * Replaces original composer autoloader with wrapper |
||
88 | * |
||
89 | * @param array $options Aspect kernel options |
||
90 | * @param AspectContainer $container |
||
91 | */ |
||
92 | public static function init(array $options = [], AspectContainer $container) |
||
122 | |||
123 | /** |
||
124 | * Autoload a class by it's name |
||
125 | */ |
||
126 | public function loadClass($class) |
||
134 | |||
135 | /** |
||
136 | * Finds either the path to the file where the class is defined, |
||
137 | * or gets the appropriate php://filter stream for the given class. |
||
138 | * |
||
139 | * @param string $class |
||
140 | * @return string|false The path/resource if found, false otherwise. |
||
141 | */ |
||
142 | public function findFile($class) |
||
158 | |||
159 | /** |
||
160 | * Adjusts original composer loader to work together with AOP engine |
||
161 | */ |
||
162 | private function adjustClassLoader() |
||
186 | |||
187 | /** |
||
188 | * Checks if the path belongs to the specific directory |
||
189 | * |
||
190 | * @param string $absolutePath Absolute path to check (should be normalized) |
||
191 | * @param array $listOfPaths List of absolute paths to check against |
||
192 | * |
||
193 | * @return bool True, if given path belongs to the list of directories |
||
194 | */ |
||
195 | private function underPath($absolutePath, array $listOfPaths) |
||
205 | |||
206 | /** |
||
207 | * Perform analysis of prefix paths |
||
208 | * |
||
209 | * @param array $prefixPaths List of prefix paths |
||
210 | * |
||
211 | * @return array List of normalized/transformed paths |
||
212 | */ |
||
213 | private function analysePrefixPaths(array $prefixPaths) |
||
233 | } |
||
234 |
If you place a parameter with a default value before a parameter with a default value, the default value of the first parameter will never be used as it will always need to be passed anyway: