1 | <?php |
||
28 | class ServiceConverter implements ParamConverterInterface |
||
29 | { |
||
30 | /** Cache name for services */ |
||
31 | const CACHE_KEY_SERVICES = 'analytics_services'; |
||
32 | const CACHE_KEY_SERVICES_TIME = 10; |
||
33 | const CACHE_KEY_SERVICES_URLS = 'analytics_services_urls'; |
||
34 | const CACHE_KEY_SERVICES_URLS_TIME = 10; |
||
35 | const CACHE_KEY_SERVICES_PREFIX = 'analytics_'; |
||
36 | |||
37 | /** @var Request */ |
||
38 | protected $request; |
||
39 | |||
40 | /** @var AnalyticsManager */ |
||
41 | protected $analyticsManager; |
||
42 | |||
43 | /** @var CacheProvider */ |
||
44 | protected $cacheProvider; |
||
45 | |||
46 | /** @var Router */ |
||
47 | protected $router; |
||
48 | |||
49 | /** @var string */ |
||
50 | protected $directory; |
||
51 | |||
52 | /** @var array */ |
||
53 | private $services = []; |
||
54 | |||
55 | /** |
||
56 | * ServiceConverter constructor. |
||
57 | * @param RequestStack $requestStack Sf Request information service |
||
58 | * @param AnalyticsManager $analyticsManager Db Manager and query control |
||
59 | * @param CacheProvider $cacheProvider Cache service |
||
60 | * @param Router $router To manage routing generation |
||
61 | * @param string $definitionDirectory Where definitions are stored |
||
62 | */ |
||
63 | public function __construct( |
||
77 | |||
78 | /** |
||
79 | * Scan base root directory for analytic definitions |
||
80 | * @return void |
||
81 | */ |
||
82 | private function init() |
||
120 | |||
121 | /** |
||
122 | * Return array of available services |
||
123 | * |
||
124 | * @return array |
||
|
|||
125 | */ |
||
126 | public function getServices() |
||
144 | |||
145 | /** |
||
146 | * Get service definition |
||
147 | * |
||
148 | * @param string $name Route name for service |
||
149 | * @throws NotFoundHttpException |
||
150 | * @return AnalyticModel |
||
151 | */ |
||
152 | private function getServiceSchemaByRoute($name) |
||
165 | |||
166 | /** |
||
167 | * Will map and find data for defined route |
||
168 | * |
||
169 | * @return array |
||
170 | */ |
||
171 | public function getData() |
||
193 | |||
194 | /** |
||
195 | * Locate and display service definition schema |
||
196 | * |
||
197 | * @return mixed |
||
198 | */ |
||
199 | public function getSchema() |
||
208 | |||
209 | /** |
||
210 | * Which service can load this Converter |
||
211 | * |
||
212 | * @param ParamConverter $configuration Configuration data |
||
213 | * @return bool |
||
214 | */ |
||
215 | public function supports(ParamConverter $configuration) |
||
219 | |||
220 | /** |
||
221 | * {@inheritdoc} |
||
222 | * |
||
223 | * Applies converting |
||
224 | * |
||
225 | * @param Request $request SF request bag |
||
226 | * @param ParamConverter $configuration Config data |
||
227 | * |
||
228 | * @throws \InvalidArgumentException When route attributes are missing |
||
229 | * @throws NotFoundHttpException When object not found |
||
230 | * @return void |
||
231 | */ |
||
232 | public function apply(Request $request, ParamConverter $configuration) |
||
240 | } |
||
241 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.