| Total Complexity | 3 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class AttrSet implements JsonSerializable, Stringable |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The attribute name |
||
| 14 | * |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private $sAttrName; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The attribute value |
||
| 21 | * |
||
| 22 | * @var Parameter |
||
| 23 | */ |
||
| 24 | private $xAttrValue; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * The constructor. |
||
| 28 | * |
||
| 29 | * @param string $sAttrName The attribute name |
||
| 30 | * @param mixed $xAttrValue The attribute value |
||
| 31 | */ |
||
| 32 | public function __construct(string $sAttrName, $xAttrValue) |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Convert this call to array, when converting the response into json. |
||
| 40 | * |
||
| 41 | * @return array |
||
| 42 | */ |
||
| 43 | public function jsonSerialize(): array |
||
| 44 | { |
||
| 45 | return [ |
||
| 46 | '_type' => 'attr', |
||
| 47 | '_name' => $this->sAttrName, |
||
| 48 | 'value' => $this->xAttrValue->jsonSerialize(), |
||
| 49 | ]; |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Returns a string representation of this call |
||
| 54 | * |
||
| 55 | * @return string |
||
| 56 | */ |
||
| 57 | public function __toString(): string |
||
| 60 | } |
||
| 61 | } |
||
| 62 |