| Total Complexity | 8 |
| Total Lines | 66 |
| Duplicated Lines | 0 % |
| Coverage | 94.12% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | abstract class Parameter implements ParameterInterface |
||
| 9 | { |
||
| 10 | use HasAttributes; |
||
|
|
|||
| 11 | |||
| 12 | /** |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | protected $properties = []; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Parameter constructor. |
||
| 19 | * |
||
| 20 | * @param array $attributes |
||
| 21 | */ |
||
| 22 | 7 | public function __construct(array $attributes = []) |
|
| 23 | { |
||
| 24 | 7 | $this->setAttributes($attributes); |
|
| 25 | 7 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * |
||
| 29 | * @param array $appends |
||
| 30 | * |
||
| 31 | * @return array|array[] |
||
| 32 | * @throws \EasyIM\Kernel\Exceptions\InvalidArgumentException |
||
| 33 | */ |
||
| 34 | 6 | public function transformToArray(array $appends = []): array |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * |
||
| 41 | * @return array |
||
| 42 | */ |
||
| 43 | 1 | public function transformParameterToArray(): array |
|
| 44 | { |
||
| 45 | 1 | $attrs = []; |
|
| 46 | |||
| 47 | 1 | foreach ($this->attributes as $parameter) { |
|
| 48 | 1 | $attrs[] = $parameter->transformToArray(); |
|
| 49 | } |
||
| 50 | |||
| 51 | 1 | return $attrs; |
|
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * |
||
| 56 | * @param array $data |
||
| 57 | * |
||
| 58 | * @return array |
||
| 59 | * @throws \EasyIM\Kernel\Exceptions\InvalidArgumentException |
||
| 60 | */ |
||
| 61 | 6 | protected function propertiesToArray(array $data): array |
|
| 74 | } |
||
| 75 | } |
||
| 76 |