| Total Complexity | 4 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class TwillUtil |
||
| 11 | { |
||
| 12 | private const SESSION_FIELD = 'twill_util'; |
||
| 13 | private const REPEATER_ID_INDEX = 'repeater_ids'; |
||
| 14 | |||
| 15 | public function hasRepeaterIdFor(int $frontEndId): ?int { |
||
| 17 | } |
||
| 18 | |||
| 19 | public function registerRepeaterId(int $frontEndId, int $dbId): self |
||
| 20 | { |
||
| 21 | $this->pushToTempStore(self::REPEATER_ID_INDEX, $frontEndId, $dbId); |
||
| 22 | |||
| 23 | return $this; |
||
| 24 | } |
||
| 25 | |||
| 26 | private function getFromTempStore(string $key, int $frontendId): ?int { |
||
| 27 | $data = Session::get(self::SESSION_FIELD . '.' . $key, []); |
||
| 28 | |||
| 29 | return $data[$frontendId] ?? null; |
||
| 30 | } |
||
| 31 | |||
| 32 | private function pushToTempStore(string $key, int $frontendId, int $dbId): void |
||
| 42 | } |
||
| 43 | } |
||
| 44 |