| Total Complexity | 6 |
| Total Lines | 73 |
| Duplicated Lines | 0 % |
| Coverage | 71.43% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Pair |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * The key for the Pair object. |
||
| 15 | * |
||
| 16 | * @var mixed |
||
| 17 | */ |
||
| 18 | private $key; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * The value for the Pair object. |
||
| 22 | * |
||
| 23 | * @var mixed |
||
| 24 | */ |
||
| 25 | private $value; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Initializes class properties. |
||
| 29 | * |
||
| 30 | * @param mixed $key |
||
| 31 | * @param mixed $value |
||
| 32 | */ |
||
| 33 | 27 | public function __construct($key, $value) |
|
| 34 | { |
||
| 35 | 27 | $this->key = $key; |
|
| 36 | 27 | $this->value = $value; |
|
| 37 | 27 | } |
|
| 38 | |||
| 39 | /** |
||
| 40 | * Allows access to the key |
||
| 41 | * property by its value. |
||
| 42 | * |
||
| 43 | * @param string $name |
||
| 44 | * |
||
| 45 | * @return mixed |
||
| 46 | */ |
||
| 47 | public function __get(string $name) |
||
| 48 | { |
||
| 49 | if ($name === $this->key) { |
||
| 50 | return $this->value; |
||
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Returns the key property. |
||
| 56 | * |
||
| 57 | * @return mixed |
||
| 58 | */ |
||
| 59 | 16 | public function getKey() |
|
| 60 | { |
||
| 61 | 16 | return $this->key; |
|
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Returns the value property. |
||
| 66 | * |
||
| 67 | * @return mixed |
||
| 68 | */ |
||
| 69 | 18 | public function getValue() |
|
| 70 | { |
||
| 71 | 18 | return $this->value; |
|
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Sets the value of the value property. |
||
| 76 | * |
||
| 77 | * @param mixed $value |
||
| 78 | * |
||
| 79 | * @return void |
||
| 80 | */ |
||
| 81 | 1 | public function setValue($value): void |
|
| 84 | 1 | } |
|
| 85 | } |
||
| 86 |