1 | <?php |
||
28 | class CachedSchemaStorage extends SchemaStorage implements CachedSchemaStorageInterface |
||
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 | 10 | public function __construct( |
|
76 | |||
77 | /** |
||
78 | * Initializes the a config cache from the schemas configured in the sulu_validation.schemas parameter. |
||
79 | */ |
||
80 | 9 | public function initializeCache() |
|
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | 8 | public function getSchemaByRoute($routeId) |
|
116 | |||
117 | /** |
||
118 | * {@inheritdoc} |
||
119 | */ |
||
120 | 9 | public function getSchema($id) |
|
128 | |||
129 | /** |
||
130 | * Locates, validates and adds schema to the cache. |
||
131 | * |
||
132 | * @param string $schemaPath |
||
133 | * @param array $serializedSchemas |
||
134 | * @param array $resources |
||
135 | * |
||
136 | * @throws MalFormedJsonException |
||
137 | * @throws InvalidArgumentException |
||
138 | * @throws FileLocatorFileNotFoundException |
||
139 | */ |
||
140 | 1 | protected function processSchema($schemaPath, array &$serializedSchemas, array &$resources) |
|
161 | |||
162 | /** |
||
163 | * Resolves references within a given schema and triggers the processing of the newly detected schemas. |
||
164 | * |
||
165 | * @param \stdClass $schema |
||
166 | * @param string $schemaFilePath |
||
167 | * @param array $serializedSchemas |
||
168 | * @param array $resources |
||
169 | * |
||
170 | * @throws MalFormedJsonException |
||
171 | * @throws InvalidArgumentException |
||
172 | * @throws FileLocatorFileNotFoundException |
||
173 | */ |
||
174 | 1 | protected function processReferencesInSchema($schema, $schemaFilePath, array &$serializedSchemas, array &$resources) |
|
186 | } |
||
187 |
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.