| Total Complexity | 4 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class PageLayoutUpdateManager extends CustomLayoutManager |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var array Keys are Page IDs, values - file names. |
||
| 16 | */ |
||
| 17 | private $fakeFiles = []; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Supply fake files for a Page. |
||
| 21 | * |
||
| 22 | * @param int $forPageId |
||
| 23 | * @param string[]|null $files Pass null to reset. |
||
| 24 | */ |
||
| 25 | public function setFakeFiles(int $forPageId, ?array $files): void |
||
| 26 | { |
||
| 27 | if ($files === null) { |
||
|
|
|||
| 28 | unset($this->fakeFiles[$forPageId]); |
||
| 29 | } else { |
||
| 30 | $this->fakeFiles[$forPageId] = $files; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Fetches fake/mock files added through $this->setFakeFiles() |
||
| 36 | * for current Page and Global (0) |
||
| 37 | * |
||
| 38 | * If none found, fall back to original method |
||
| 39 | * |
||
| 40 | * @param PageInterface $page |
||
| 41 | * @return array |
||
| 42 | */ |
||
| 43 | public function fetchAvailableFiles(PageInterface $page): array |
||
| 51 | } |
||
| 52 | } |
||
| 53 |