Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
30 / 30 |
|
100.00% |
20 / 20 |
CRAP | |
100.00% |
1 / 1 |
| CategoryEntity | |
100.00% |
30 / 30 |
|
100.00% |
20 / 20 |
20 | |
100.00% |
1 / 1 |
| getActive | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setActive | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getDescription | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setDescription | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getGroupId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setGroupId | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setId | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getLang | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setLang | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setName | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getParentId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setParentId | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getUserId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setUserId | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getImage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setImage | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getShowHome | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setShowHome | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Category entity class. |
| 5 | * |
| 6 | * This Source Code Form is subject to the terms of the Mozilla Public License, |
| 7 | * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
| 8 | * obtain one at https://mozilla.org/MPL/2.0/. |
| 9 | * |
| 10 | * @package phpMyFAQ |
| 11 | * @author Thorsten Rinne <thorsten@phpmyfaq.de> |
| 12 | * @copyright 2014-2026 phpMyFAQ Team |
| 13 | * @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
| 14 | * @link https://www.phpmyfaq.de |
| 15 | * @since 2014-08-14 |
| 16 | */ |
| 17 | |
| 18 | declare(strict_types=1); |
| 19 | |
| 20 | namespace phpMyFAQ\Entity; |
| 21 | |
| 22 | /** |
| 23 | * Class CategoryEntity |
| 24 | * |
| 25 | * @package phpMyFAQ\Category |
| 26 | */ |
| 27 | class CategoryEntity |
| 28 | { |
| 29 | private ?int $id = null; |
| 30 | |
| 31 | private ?string $lang = null; |
| 32 | |
| 33 | private ?int $parentId = null; |
| 34 | |
| 35 | private ?string $name = null; |
| 36 | |
| 37 | private ?string $description = null; |
| 38 | |
| 39 | private ?int $userId = null; |
| 40 | |
| 41 | private int $groupId = -1; |
| 42 | |
| 43 | private ?bool $active = null; |
| 44 | |
| 45 | private ?bool $showHome = null; |
| 46 | |
| 47 | private ?string $image = ''; |
| 48 | |
| 49 | public function getActive(): bool |
| 50 | { |
| 51 | return $this->active ?? false; |
| 52 | } |
| 53 | |
| 54 | public function setActive(bool $active): CategoryEntity |
| 55 | { |
| 56 | $this->active = $active; |
| 57 | |
| 58 | return $this; |
| 59 | } |
| 60 | |
| 61 | public function getDescription(): ?string |
| 62 | { |
| 63 | return $this->description; |
| 64 | } |
| 65 | |
| 66 | public function setDescription(?string $description): CategoryEntity |
| 67 | { |
| 68 | $this->description = $description; |
| 69 | |
| 70 | return $this; |
| 71 | } |
| 72 | |
| 73 | public function getGroupId(): int |
| 74 | { |
| 75 | return $this->groupId; |
| 76 | } |
| 77 | |
| 78 | public function setGroupId(int $groupId): CategoryEntity |
| 79 | { |
| 80 | $this->groupId = $groupId; |
| 81 | |
| 82 | return $this; |
| 83 | } |
| 84 | |
| 85 | public function getId(): int |
| 86 | { |
| 87 | return (int) $this->id; |
| 88 | } |
| 89 | |
| 90 | public function setId(int $id): CategoryEntity |
| 91 | { |
| 92 | $this->id = $id; |
| 93 | |
| 94 | return $this; |
| 95 | } |
| 96 | |
| 97 | public function getLang(): string |
| 98 | { |
| 99 | return $this->lang ?? ''; |
| 100 | } |
| 101 | |
| 102 | public function setLang(string $lang): CategoryEntity |
| 103 | { |
| 104 | $this->lang = $lang; |
| 105 | |
| 106 | return $this; |
| 107 | } |
| 108 | |
| 109 | public function getName(): string |
| 110 | { |
| 111 | return $this->name ?? ''; |
| 112 | } |
| 113 | |
| 114 | public function setName(string $name): CategoryEntity |
| 115 | { |
| 116 | $this->name = $name; |
| 117 | |
| 118 | return $this; |
| 119 | } |
| 120 | |
| 121 | public function getParentId(): int |
| 122 | { |
| 123 | return (int) $this->parentId; |
| 124 | } |
| 125 | |
| 126 | public function setParentId(int $parentId): CategoryEntity |
| 127 | { |
| 128 | $this->parentId = $parentId; |
| 129 | |
| 130 | return $this; |
| 131 | } |
| 132 | |
| 133 | public function getUserId(): int |
| 134 | { |
| 135 | return (int) $this->userId; |
| 136 | } |
| 137 | |
| 138 | public function setUserId(int $userId): CategoryEntity |
| 139 | { |
| 140 | $this->userId = $userId; |
| 141 | |
| 142 | return $this; |
| 143 | } |
| 144 | |
| 145 | public function getImage(): ?string |
| 146 | { |
| 147 | return $this->image; |
| 148 | } |
| 149 | |
| 150 | public function setImage(?string $image): CategoryEntity |
| 151 | { |
| 152 | $this->image = $image; |
| 153 | |
| 154 | return $this; |
| 155 | } |
| 156 | |
| 157 | public function getShowHome(): bool |
| 158 | { |
| 159 | return (bool) $this->showHome; |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * @param bool $showHome |
| 164 | */ |
| 165 | public function setShowHome(?bool $showHome): CategoryEntity |
| 166 | { |
| 167 | $this->showHome = $showHome; |
| 168 | |
| 169 | return $this; |
| 170 | } |
| 171 | } |