| Total Complexity | 8 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Coverage | 70.59% |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class StringItem implements ItemInterface |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $value; |
||
| 22 | |||
| 23 | 12 | public function __construct(string $value) |
|
| 24 | { |
||
| 25 | 12 | $this->value = $value; |
|
| 26 | 12 | } |
|
| 27 | |||
| 28 | public function setValue(string $value) |
||
| 31 | } |
||
| 32 | |||
| 33 | 27 | public function getValue(): ?string |
|
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param Comparable|StringItem $b |
||
| 40 | * @return int |
||
| 41 | */ |
||
| 42 | 26 | public function compareTo(Comparable $b): int |
|
| 43 | { |
||
| 44 | /** @var StringItem $b */ |
||
| 45 | 26 | $diff = strcasecmp($this->getValue(), $b->getValue()); |
|
| 46 | 26 | if ($diff === 0) { |
|
| 47 | 11 | return $diff; |
|
| 48 | } |
||
| 49 | 26 | return $diff > 0 ? 1 : -1; |
|
| 50 | } |
||
| 51 | |||
| 52 | 10 | public function __toString() |
|
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @param ItemInterface|StringItem $item |
||
| 59 | * @return bool |
||
| 60 | */ |
||
| 61 | public function equals(ItemInterface $item): bool |
||
| 66 |