| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Abstract base for the concrete View_* components that replaced |
| 9 |
* the legacy ViewTrait_* family. Each component holds: |
| 10 |
* - typed back-reference to the owning View facade (for external code paths) |
| 11 |
* - typed sibling references for every other component (for cross-component |
| 12 |
* calls). Sibling references are set after View constructs all components |
| 13 |
* via setSiblingComponents(); access via $this->shared, $this->ui, etc. |
| 14 |
* - the shared dependency graph (functions, plugin logic, logging, the four |
| 15 |
* repository interfaces, plus the view-build orchestrator) |
| 16 |
* |
| 17 |
* Cross-component access goes through typed sibling properties so PHPStan |
| 18 |
* can fully resolve calls such as $this->optionsPresenter->getCheckedAttr(...). The View facade |
| 19 |
* keeps its __call dispatcher for the (smaller) set of EXTERNAL callers |
| 20 |
* that hold a View instance rather than a component. |
| 21 |
*/ |
| 22 |
abstract class ABJ_404_Solution_ViewComponent { |
| 23 |
|
| 24 |
/** @var ABJ_404_Solution_View */ |
| 25 |
protected $view; |
| 26 |
|
| 27 |
/** @var ABJ_404_Solution_Functions */ |
| 28 |
protected $f; |
| 29 |
|
| 30 |
/** @var ABJ_404_Solution_PluginLogic */ |
| 31 |
protected $logic; |
| 32 |
|
| 33 |
/** @var ABJ_404_Solution_Logging */ |
| 34 |
protected $logger; |
| 35 |
|
| 36 |
/** @var ABJ_404_Solution_ViewReadServiceInterface */ |
| 37 |
protected $viewReadService; |
| 38 |
|
| 39 |
/** @var ABJ_404_Solution_LogsRepositoryInterface */ |
| 40 |
protected $logsRepository; |
| 41 |
|
| 42 |
/** @var ABJ_404_Solution_RedirectsRepositoryInterface */ |
| 43 |
protected $redirectsRepository; |
| 44 |
|
| 45 |
/** @var ABJ_404_Solution_ContentRepositoryInterface */ |
| 46 |
protected $contentRepository; |
| 47 |
|
| 48 |
/** @var ABJ_404_Solution_StatsRepositoryInterface */ |
| 49 |
protected $statsRepository; |
| 50 |
|
| 51 |
/** @var ABJ_404_Solution_View_Shared */ |
| 52 |
protected $shared; |
| 53 |
|
| 54 |
/** @var ABJ_404_Solution_View_UI */ |
| 55 |
protected $ui; |
| 56 |
|
| 57 |
/** @var ABJ_404_Solution_View_AdminChrome */ |
| 58 |
protected $adminChrome; |
| 59 |
|
| 60 |
/** @var ABJ_404_Solution_View_OptionsPresenter */ |
| 61 |
protected $optionsPresenter; |
| 62 |
|
| 63 |
/** @var ABJ_404_Solution_View_Stats */ |
| 64 |
protected $stats; |
| 65 |
|
| 66 |
/** @var ABJ_404_Solution_View_Tools */ |
| 67 |
protected $tools; |
| 68 |
|
| 69 |
/** @var ABJ_404_Solution_View_Settings */ |
| 70 |
protected $settings; |
| 71 |
|
| 72 |
/** @var ABJ_404_Solution_View_SettingsSections */ |
| 73 |
protected $settingsSections; |
| 74 |
|
| 75 |
/** @var ABJ_404_Solution_View_SimpleSettings */ |
| 76 |
protected $simpleSettings; |
| 77 |
|
| 78 |
/** @var ABJ_404_Solution_View_Redirects */ |
| 79 |
protected $redirects; |
| 80 |
|
| 81 |
/** @var ABJ_404_Solution_View_RedirectsTable */ |
| 82 |
protected $redirectsTable; |
| 83 |
|
| 84 |
/** @var ABJ_404_Solution_View_CapturedURLsTable */ |
| 85 |
protected $capturedURLsTable; |
| 86 |
|
| 87 |
/** @var ABJ_404_Solution_View_RedirectForms */ |
| 88 |
protected $redirectForms; |
| 89 |
|
| 90 |
/** @var ABJ_404_Solution_View_ListTableChrome */ |
| 91 |
protected $listTableChrome; |
| 92 |
|
| 93 |
/** @var ABJ_404_Solution_View_RedirectTypeUI */ |
| 94 |
protected $redirectTypeUI; |
| 95 |
|
| 96 |
/** @var ABJ_404_Solution_View_RedirectConditions */ |
| 97 |
protected $redirectConditions; |
| 98 |
|
| 99 |
/** @var ABJ_404_Solution_View_Logs */ |
| 100 |
protected $logs; |
| 101 |
|
| 102 |
/** |
| 103 |
* @param ABJ_404_Solution_View $view |
| 104 |
* @param ABJ_404_Solution_Functions $functions |
| 105 |
* @param ABJ_404_Solution_PluginLogic $pluginLogic |
| 106 |
* @param ABJ_404_Solution_Logging $logging |
| 107 |
* @param ABJ_404_Solution_ViewReadServiceInterface $viewReadService |
| 108 |
* @param ABJ_404_Solution_LogsRepositoryInterface $logsRepository |
| 109 |
* @param ABJ_404_Solution_RedirectsRepositoryInterface $redirectsRepository |
| 110 |
* @param ABJ_404_Solution_ContentRepositoryInterface $contentRepository |
| 111 |
* @param ABJ_404_Solution_StatsRepositoryInterface $statsRepository |
| 112 |
*/ |
| 113 |
public function __construct( |
| 114 |
ABJ_404_Solution_View $view, |
| 115 |
$functions, |
| 116 |
$pluginLogic, |
| 117 |
$logging, |
| 118 |
$viewReadService, |
| 119 |
$logsRepository, |
| 120 |
$redirectsRepository, |
| 121 |
$contentRepository, |
| 122 |
$statsRepository |
| 123 |
) { |
| 124 |
$this->view = $view; |
| 125 |
$this->f = $functions; |
| 126 |
$this->logic = $pluginLogic; |
| 127 |
$this->logger = $logging; |
| 128 |
$this->viewReadService = $viewReadService; |
| 129 |
$this->logsRepository = $logsRepository; |
| 130 |
$this->redirectsRepository = $redirectsRepository; |
| 131 |
$this->contentRepository = $contentRepository; |
| 132 |
$this->statsRepository = $statsRepository; |
| 133 |
} |
| 134 |
|
| 135 |
/** |
| 136 |
* Wire up sibling component references after all components are constructed. |
| 137 |
* Called once by ABJ_404_Solution_View::buildComponents(). |
| 138 |
*/ |
| 139 |
public function setSiblingComponents( |
| 140 |
ABJ_404_Solution_View_Shared $shared, |
| 141 |
ABJ_404_Solution_View_UI $ui, |
| 142 |
ABJ_404_Solution_View_AdminChrome $adminChrome, |
| 143 |
ABJ_404_Solution_View_OptionsPresenter $optionsPresenter, |
| 144 |
ABJ_404_Solution_View_Stats $stats, |
| 145 |
ABJ_404_Solution_View_Tools $tools, |
| 146 |
ABJ_404_Solution_View_Settings $settings, |
| 147 |
ABJ_404_Solution_View_SettingsSections $settingsSections, |
| 148 |
ABJ_404_Solution_View_SimpleSettings $simpleSettings, |
| 149 |
ABJ_404_Solution_View_Redirects $redirects, |
| 150 |
ABJ_404_Solution_View_RedirectsTable $redirectsTable, |
| 151 |
ABJ_404_Solution_View_CapturedURLsTable $capturedURLsTable, |
| 152 |
ABJ_404_Solution_View_RedirectForms $redirectForms, |
| 153 |
ABJ_404_Solution_View_ListTableChrome $listTableChrome, |
| 154 |
ABJ_404_Solution_View_RedirectTypeUI $redirectTypeUI, |
| 155 |
ABJ_404_Solution_View_RedirectConditions $redirectConditions, |
| 156 |
ABJ_404_Solution_View_Logs $logs |
| 157 |
): void { |
| 158 |
$this->shared = $shared; |
| 159 |
$this->ui = $ui; |
| 160 |
$this->adminChrome = $adminChrome; |
| 161 |
$this->optionsPresenter = $optionsPresenter; |
| 162 |
$this->stats = $stats; |
| 163 |
$this->tools = $tools; |
| 164 |
$this->settings = $settings; |
| 165 |
$this->settingsSections = $settingsSections; |
| 166 |
$this->simpleSettings = $simpleSettings; |
| 167 |
$this->redirects = $redirects; |
| 168 |
$this->redirectsTable = $redirectsTable; |
| 169 |
$this->capturedURLsTable = $capturedURLsTable; |
| 170 |
$this->redirectForms = $redirectForms; |
| 171 |
$this->listTableChrome = $listTableChrome; |
| 172 |
$this->redirectTypeUI = $redirectTypeUI; |
| 173 |
$this->redirectConditions = $redirectConditions; |
| 174 |
$this->logs = $logs; |
| 175 |
} |
| 176 |
} |
| 177 |
|