| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4.5923 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 1 | public function add(string $key, string $value): static |
|
| 17 | { |
||
| 18 | 1 | if (count($this->data) >= 3) { |
|
| 19 | throw new \Exception('Max 3 items allowed in metadata.'); |
||
| 20 | } |
||
| 21 | 1 | if (strlen($key) > 50) { |
|
| 22 | throw new \Exception('Key length max - 50 chars.'); |
||
| 23 | } |
||
| 24 | 1 | if (strlen($value) > 500) { |
|
| 25 | throw new \Exception('Value length max - 500 chars.'); |
||
| 26 | } |
||
| 27 | |||
| 28 | 1 | $this->data[$key] = $value; |
|
| 29 | |||
| 30 | 1 | return $this; |
|
| 31 | } |
||
| 38 |