| Conditions | 5 |
| Paths | 3 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 227 | public function __construct($name, array $parameters, $content, $bbCode = null) |
|
| 17 | { |
||
| 18 | /** @psalm-suppress RedundantConditionGivenDocblockType, DocblockTypeContradiction */ |
||
| 19 | 227 | if(false === is_string($name) || '' === $name) { |
|
| 20 | 1 | throw new \InvalidArgumentException('Shortcode name must be a non-empty string!'); |
|
| 21 | } |
||
| 22 | |||
| 23 | /** @psalm-suppress MissingClosureParamType, MissingClosureReturnType */ |
||
| 24 | $isStringOrNull = function($value) { return is_string($value) || null === $value; }; |
||
| 25 | 226 | if(count(array_filter($parameters, $isStringOrNull)) !== count($parameters)) { |
|
| 26 | 1 | throw new \InvalidArgumentException('Parameter values must be either string or empty (null)!'); |
|
| 27 | } |
||
| 28 | |||
| 29 | 225 | $this->name = $name; |
|
| 30 | 225 | $this->parameters = $parameters; |
|
| 31 | 225 | $this->content = $content; |
|
| 32 | 225 | $this->bbCode = $bbCode; |
|
| 33 | 225 | } |
|
| 34 | |||
| 40 |