| Conditions | 5 |
| Paths | 5 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 3 | public static function renderAttributes(array $attributes): ?string |
|
| 16 | { |
||
| 17 | 3 | $attributesString = null; |
|
| 18 | 3 | foreach ($attributes as $attributeName => $attributeValue) { |
|
| 19 | 3 | if (false === is_string($attributeName)) { |
|
| 20 | 1 | throw new InvalidArgumentException('Attribute names have to be of type string, "' . gettype($attributeName) . '"(' . $attributeName . ') given.'); |
|
| 21 | } |
||
| 22 | |||
| 23 | 2 | if (false === is_string($attributeValue)) { |
|
| 24 | 1 | throw new InvalidArgumentException('Attribute values have to be of type string, "' . gettype($attributeValue) . '"(' . $attributeValue . ') given.'); |
|
| 25 | } |
||
| 26 | |||
| 27 | 1 | if (null !== $attributesString) { |
|
| 28 | 1 | $attributesString .= ' '; |
|
| 29 | } |
||
| 30 | |||
| 31 | 1 | $attributesString .= self::renderAttribute($attributeName, $attributeValue); |
|
| 32 | } |
||
| 33 | |||
| 34 | 1 | return $attributesString; |
|
| 35 | } |
||
| 42 |