1 | <?php |
||
33 | class GearmanParser |
||
34 | { |
||
35 | |||
36 | /** |
||
37 | * @var array |
||
38 | * |
||
39 | * Bundles loaded by kernel |
||
40 | */ |
||
41 | private $kernelBundles; |
||
42 | |||
43 | /** |
||
44 | * @var KernelInterface |
||
45 | * |
||
46 | * Kernel object |
||
47 | */ |
||
48 | private $kernel; |
||
49 | |||
50 | /** |
||
51 | * @var Reader |
||
52 | * |
||
53 | * Annotation Reader |
||
54 | */ |
||
55 | private $reader; |
||
56 | |||
57 | /** |
||
58 | * @var Finder |
||
59 | * |
||
60 | * Finder |
||
61 | */ |
||
62 | private $finder; |
||
63 | |||
64 | /** |
||
65 | * @var array |
||
66 | * |
||
67 | * Bundles available to perform search |
||
68 | */ |
||
69 | private $bundles; |
||
70 | |||
71 | /** |
||
72 | * @var array |
||
73 | * |
||
74 | * Namespaces paths to be searched |
||
75 | */ |
||
76 | private $resources; |
||
77 | |||
78 | /** |
||
79 | * @var array |
||
80 | * |
||
81 | * Collection of servers to connect |
||
82 | */ |
||
83 | private $servers; |
||
84 | |||
85 | /** |
||
86 | * @var array |
||
87 | * |
||
88 | * Default settings defined by user in config.yml |
||
89 | */ |
||
90 | private $defaultSettings; |
||
91 | |||
92 | /** |
||
93 | * Root kernel directory |
||
94 | * |
||
95 | * @var string |
||
96 | */ |
||
97 | private $rootDir; |
||
98 | |||
99 | /** |
||
100 | * Construct method |
||
101 | * |
||
102 | * @param KernelInterface $kernel Kernel instance |
||
103 | * @param Reader $reader Reader |
||
104 | * @param Finder $finder Finder |
||
105 | * @param array $bundles Bundle array where to parse workers, defined in configuration |
||
106 | * @param array $resources Array of namespace paths to be searched for worker annotations |
||
107 | * @param array $servers Server list defined on configuration |
||
108 | * @param array $defaultSettings Default settings defined on configuration |
||
109 | */ |
||
110 | 5 | public function __construct( |
|
130 | |||
131 | /** |
||
132 | * Loads Worker Collection from parsed files |
||
133 | * |
||
134 | * @return WorkerCollection collection of all info |
||
135 | */ |
||
136 | 1 | public function load() |
|
143 | |||
144 | /** |
||
145 | * Return Gearman bundle settings, previously loaded by method load() |
||
146 | * |
||
147 | * If settings are not loaded, a SettingsNotLoadedException Exception is thrown |
||
148 | * |
||
149 | * @param array $kernelBundles Kernel bundles |
||
150 | * @param array $bundles Bundle array of settings |
||
151 | * |
||
152 | * @return array Return an array containing paths and ignore paths |
||
153 | */ |
||
154 | 6 | public function loadBundleNamespaceMap(array $kernelBundles, array $bundles) |
|
198 | |||
199 | /** |
||
200 | * Get resource paths |
||
201 | * @param string $rootDir |
||
202 | * @param array $resources |
||
203 | * @return array |
||
204 | */ |
||
205 | public function loadResourceNamespaceMap($rootDir, array $resources) |
||
211 | |||
212 | /** |
||
213 | * Perform a parsing inside all namespace map |
||
214 | * |
||
215 | * Creates an empty worker collection and, if exist some parseable files |
||
216 | * parse them, filling this object |
||
217 | * |
||
218 | * @param Finder $finder Finder |
||
219 | * @param Reader $reader Reader |
||
220 | * @param array $paths Paths where to look for |
||
221 | * @param array $excludedPaths Paths to ignore |
||
222 | * |
||
223 | * @return WorkerCollection collection of all info |
||
224 | */ |
||
225 | 3 | public function parseNamespaceMap( |
|
248 | |||
249 | /** |
||
250 | * Load all workers with their jobs |
||
251 | * |
||
252 | * @param Finder $finder Finder |
||
253 | * @param Reader $reader Reader |
||
254 | * @param WorkerCollection $workerCollection Worker collection |
||
255 | * |
||
256 | * @return GearmanParser self Object |
||
257 | */ |
||
258 | public function parseFiles( |
||
298 | |||
299 | /** |
||
300 | * Returns file class namespace, if exists |
||
301 | * |
||
302 | * @param string $file A PHP file path |
||
303 | * |
||
304 | * @return string|false Full class namespace if found, false otherwise |
||
305 | */ |
||
306 | 2 | public function getFileClassNamespace($file) |
|
318 | } |
||
319 |