Conditions | 5 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function render(Formatter $formatter, array $schema, string $role): ?string |
||
24 | { |
||
25 | $row = \sprintf('%s: ', $formatter->title($this->title)); |
||
26 | |||
27 | if (! isset($schema[$this->property])) { |
||
28 | return $this->required ? $row . $formatter->error('not defined') : null; |
||
29 | } |
||
30 | |||
31 | $propertyValue = $schema[$this->property]; |
||
32 | |||
33 | if (\is_array($propertyValue)) { |
||
34 | if (\count($propertyValue) >= 1) { |
||
35 | return $row . $this->convertArrayToString($formatter, $propertyValue); |
||
36 | } |
||
37 | $propertyValue = '[]'; |
||
38 | } |
||
39 | |||
40 | return \sprintf( |
||
41 | '%s%s', |
||
42 | $row, |
||
43 | $formatter->typecast($propertyValue) |
||
44 | ); |
||
61 |