| Total Complexity | 4 | 
| Total Lines | 60 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 14 | trait IndexedElementTrait | ||
| 15 | { | ||
| 16 | /** | ||
| 17 | * The index for this endpoint. | ||
| 18 | * | ||
| 19 | * @var int | ||
| 20 | */ | ||
| 21 | protected int $index; | ||
| 22 | |||
| 23 | /** | ||
| 24 | * Whether this endpoint is the default. | ||
| 25 | * | ||
| 26 | * @var bool|null | ||
| 27 | */ | ||
| 28 | protected ?bool $isDefault = null; | ||
| 29 | |||
| 30 | |||
| 31 | /** | ||
| 32 | * Collect the value of the index property. | ||
| 33 | * | ||
| 34 | * @return int | ||
| 35 | */ | ||
| 36 | public function getIndex(): int | ||
| 37 |     { | ||
| 38 | return $this->index; | ||
| 39 | } | ||
| 40 | |||
| 41 | |||
| 42 | /** | ||
| 43 | * Set the value of the index property. | ||
| 44 | * | ||
| 45 | * @param int $index | ||
| 46 | * @throws \SimpleSAML\Assert\AssertionFailedException | ||
| 47 | */ | ||
| 48 | protected function setIndex(int $index): void | ||
| 49 |     { | ||
| 50 | Assert::range($index, 0, 65535); | ||
| 51 | $this->index = $index; | ||
| 52 | } | ||
| 53 | |||
| 54 | |||
| 55 | /** | ||
| 56 | * Collect the value of the isDefault property. | ||
| 57 | * | ||
| 58 | * @return bool|null | ||
| 59 | */ | ||
| 60 | public function getIsDefault(): ?bool | ||
| 61 |     { | ||
| 62 | return $this->isDefault; | ||
| 63 | } | ||
| 64 | |||
| 65 | |||
| 66 | /** | ||
| 67 | * Set the value of the isDefault property. | ||
| 68 | * | ||
| 69 | * @param bool|null $flag | ||
| 70 | */ | ||
| 71 | protected function setIsDefault(?bool $flag): void | ||
| 74 | } | ||
| 75 | } | ||
| 76 |