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() |
|
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | 8 | public function getSchemaByRoute($routeId) |
|
114 | |||
115 | /** |
||
116 | * {@inheritdoc} |
||
117 | */ |
||
118 | 9 | public function getSchema($id) |
|
126 | |||
127 | /** |
||
128 | * Locates, validates and adds schema to the cache. |
||
129 | * |
||
130 | * @param string $schemaPath |
||
131 | * @param array $serializedSchemas |
||
132 | * @param array $resources |
||
133 | * |
||
134 | * @throws MalFormedJsonException |
||
135 | * @throws InvalidArgumentException |
||
136 | * @throws FileLocatorFileNotFoundException |
||
137 | */ |
||
138 | 1 | protected function processSchema($schemaPath, array &$serializedSchemas, array &$resources) |
|
159 | |||
160 | /** |
||
161 | * Resolves references within a given schema and triggers the processing of the newly detected schemas. |
||
162 | * |
||
163 | * @param \stdClass $schema |
||
164 | * @param string $schemaFilePath |
||
165 | * @param array $serializedSchemas |
||
166 | * @param array $resources |
||
167 | * |
||
168 | * @throws MalFormedJsonException |
||
169 | * @throws InvalidArgumentException |
||
170 | * @throws FileLocatorFileNotFoundException |
||
171 | */ |
||
172 | 1 | protected function processReferencesInSchema($schema, $schemaFilePath, array &$serializedSchemas, array &$resources) |
|
184 | } |
||
185 |
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.