| Total Complexity | 5 |
| Total Lines | 61 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class Parameter implements ArrayableInterface |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var array |
||
| 16 | */ |
||
| 17 | protected $parameters = []; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Returns a new Parameter instance. |
||
| 21 | * |
||
| 22 | * @return Parameter |
||
| 23 | */ |
||
| 24 | public static function instance(): Parameter |
||
| 25 | { |
||
| 26 | return new static(); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Add a parameter. |
||
| 31 | * |
||
| 32 | * @param string $parameter |
||
| 33 | * @param mixed $value |
||
| 34 | * |
||
| 35 | * @return Parameter Fluent Interface |
||
| 36 | */ |
||
| 37 | public function set($parameter, $value): Parameter |
||
| 38 | { |
||
| 39 | $this->parameters[SCT::toHyphen($parameter)] = VT::toString($value); |
||
| 40 | |||
| 41 | return $this; |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Remove a parameter. |
||
| 46 | * |
||
| 47 | * @param string $parameter |
||
| 48 | * |
||
| 49 | * @return Parameter Fluent Interface |
||
| 50 | */ |
||
| 51 | public function remove($parameter): Parameter |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Retrieves all not null attributes in an associative array. |
||
| 64 | * |
||
| 65 | * The keys in hash style: Ex: is-member |
||
| 66 | * The values as string |
||
| 67 | * |
||
| 68 | * @return string[] |
||
| 69 | */ |
||
| 70 | public function toArray(): array |
||
| 73 | } |
||
| 74 | } |
||
| 75 |