| Total Complexity | 8 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | final class ETag extends BaseHeaderValue |
||
| 14 | { |
||
| 15 | public const NAME = 'ETag'; |
||
| 16 | |||
| 17 | private string $tag = ''; |
||
| 18 | private bool $toStringFromTag = false; |
||
| 19 | private bool $weak = true; |
||
| 20 | |||
| 21 | 3 | public function __toString(): string |
|
| 22 | { |
||
| 23 | 3 | if ($this->toStringFromTag) { |
|
| 24 | 1 | return ($this->weak ? 'W/' : '') . '"' . $this->tag . '"'; |
|
| 25 | } else { |
||
| 26 | 2 | return $this->value; |
|
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | 9 | public function getTag(): string |
|
| 33 | } |
||
| 34 | |||
| 35 | 9 | public function isWeak(): bool |
|
| 36 | { |
||
| 37 | 9 | return $this->weak; |
|
| 38 | } |
||
| 39 | |||
| 40 | 4 | public function withTag(string $tag, bool $weak = true): self |
|
| 47 | } |
||
| 48 | |||
| 49 | 12 | protected function setValue(string $value): void |
|
| 59 | } |
||
| 60 | 12 | } |
|
| 61 | } |
||
| 62 |