Lines
100.00%
16 / 16
Methods
100.00%
10 / 10
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| setCategory | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 1 | ||
| getCategory | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| category | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| plurals | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| setCategoryRelation | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 1 | ||
| setTags | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 1 | ||
| setPlurals | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 1 | ||
| setSessionId | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 1 | ||
| setConfiguration | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 1 | ||
| getConfiguration | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 33 | abstract class AbstractHelper | |
| 34 | { | |
| 35 | protected ?Category $Category = null; | |
| 36 | ||
| 37 | protected Relation $categoryRelation; | |
| 38 | ||
| 39 | protected ?Tags $Tags = null; | |
| 40 | ||
| 41 | protected ?Plurals $plurals = null; | |
| 42 | ||
| 43 | protected mixed $sessionId = null; | |
| 44 | ||
| 45 | protected Configuration $configuration; | |
| 46 | ||
| 47 | public function setCategory(Category $Category): AbstractHelper | |
| 48 | { | |
| 49 | $this->Category = $Category; | |
| 50 | return $this; | |
| 51 | } | |
| 52 | ||
| 53 | public function getCategory(): Category | |
| 54 | { | |
| 55 | return $this->category(); | |
| 56 | } | |
| 57 | ||
| 58 | /** | |
| 59 | * Returns the category or fails loudly when setCategory() was not called. | |
| 60 | */ | |
| 61 | protected function category(): Category | |
| 62 | { | |
| 63 | return $this->Category ?? throw new \LogicException('setCategory() must be called before use.'); | |
| 64 | } | |
| 65 | ||
| 66 | /** | |
| 67 | * Returns the plurals helper or fails loudly when setPlurals() was not called. | |
| 68 | */ | |
| 69 | protected function plurals(): Plurals | |
| 70 | { | |
| 71 | return $this->plurals ?? throw new \LogicException('setPlurals() must be called before use.'); | |
| 72 | } | |
| 73 | ||
| 74 | public function setCategoryRelation(Relation $categoryRelation): AbstractHelper | |
| 75 | { | |
| 76 | $this->categoryRelation = $categoryRelation; | |
| 77 | return $this; | |
| 78 | } | |
| 79 | ||
| 80 | public function setTags(Tags $Tags): AbstractHelper | |
| 81 | { | |
| 82 | $this->Tags = $Tags; | |
| 83 | return $this; | |
| 84 | } | |
| 85 | ||
| 86 | public function setPlurals(Plurals $plurals): AbstractHelper | |
| 87 | { | |
| 88 | $this->plurals = $plurals; | |
| 89 | return $this; | |
| 90 | } | |
| 91 | ||
| 92 | public function setSessionId(int|string $sid): AbstractHelper | |
| 93 | { | |
| 94 | $this->sessionId = $sid; | |
| 95 | return $this; | |
| 96 | } | |
| 97 | ||
| 98 | public function setConfiguration(Configuration $configuration): AbstractHelper | |
| 99 | { | |
| 100 | $this->configuration = $configuration; | |
| 101 | return $this; | |
| 102 | } | |
| 103 | ||
| 104 | public function getConfiguration(): Configuration | |
| 105 | { | |
| 106 | return $this->configuration; | |
| 107 | } | |
| 108 | } |