Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | public function compile(): void |
||
39 | { |
||
40 | // Decode JSON content |
||
41 | try { |
||
42 | $decoded = Json::decode('[' . $this->getStringContent() . ']'); |
||
43 | } catch (JsonException $exception) { |
||
44 | throw new AnnotationParseException('"params" annotation content is invalid (invalid JSON content)'); |
||
45 | } |
||
46 | if (! Validator::arrayVal()->each(Validator::stringType(), Validator::intType())->validate($decoded)) { |
||
47 | throw new AnnotationParseException('"params" annotation content is invalid (must contains strings only)'); |
||
48 | } |
||
49 | $this->parameters = $decoded; |
||
50 | } |
||
60 |