1 | <?php |
||
28 | class CachedSchemaStorage extends SchemaStorage |
||
29 | { |
||
30 | const FILE_PREFIX = 'file://'; |
||
31 | |||
32 | /** |
||
33 | * @var FileLocatorInterface |
||
34 | */ |
||
35 | private $fileLocator; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | private $configuredSchemas; |
||
41 | |||
42 | /** |
||
43 | * @var bool |
||
44 | */ |
||
45 | private $debugMode; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | private $cacheFilePath; |
||
51 | |||
52 | /** |
||
53 | * @var bool |
||
54 | */ |
||
55 | private $isInitialized = false; |
||
56 | |||
57 | /** |
||
58 | * @param array $configuredSchemas array containing all file paths to configured schemas |
||
59 | * @param FileLocatorInterface $fileLocator |
||
60 | * @param string $cacheFilePath |
||
61 | * @param string $environment |
||
62 | */ |
||
63 | public function __construct( |
||
76 | |||
77 | /** |
||
78 | * Initializes the a config cache from the schemas configured in the sulu_validation.schemas parameter. |
||
79 | */ |
||
80 | public function initializeCache() |
||
100 | |||
101 | /** |
||
102 | * Returns a based on a given route id. |
||
103 | * |
||
104 | * @param string $routeId |
||
105 | * |
||
106 | * @return \stdClass |
||
107 | * |
||
108 | * @throws InvalidArgumentException |
||
109 | */ |
||
110 | public function getSchemaByRoute($routeId) |
||
116 | |||
117 | /** |
||
118 | * Locates, validates and adds schema to the cache. |
||
119 | * |
||
120 | * @param string $schemaPath |
||
121 | * @param array $serializedSchemas |
||
122 | * @param array $resources |
||
123 | * |
||
124 | * @throws MalFormedJsonException |
||
125 | * @throws InvalidArgumentException |
||
126 | * @throws FileLocatorFileNotFoundException |
||
127 | */ |
||
128 | protected function processSchema($schemaPath, array &$serializedSchemas, array &$resources) |
||
151 | |||
152 | /** |
||
153 | * Resolves references within a given schema and triggers the processing of the newly detected schemas. |
||
154 | * |
||
155 | * @param \stdClass $schema |
||
156 | * @param string $schemaFilePath |
||
157 | * @param array $serializedSchemas |
||
158 | * @param array $resources |
||
159 | * |
||
160 | * @throws MalFormedJsonException |
||
161 | * @throws InvalidArgumentException |
||
162 | * @throws FileLocatorFileNotFoundException |
||
163 | */ |
||
164 | protected function processReferencesInSchema($schema, $schemaFilePath, array &$serializedSchemas, array &$resources) |
||
176 | } |
||
177 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.