PluginProbe
404 Solution / trunk
404 Solution vtrunk
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / admin / AdminActionsDependencies.php

AdminActionsDependencies.php in 404 Solution trunk, at includes/admin/AdminActionsDependencies.php

132 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 /**
8 * Immutable dependency bundle passed to
9 * {@see ABJ_404_Solution_PluginLogicAdminActions::__construct()}.
10 *
11 * Replaces a 10-positional-parameter constructor (audit source
12 * design-audit-2026-05-29.md, criterion 220 Interface Size), matching the
13 * RedirectSpec precedent from the same audit (queue task c738).
14 *
15 * Parameters are deliberately untyped: PluginLogic's constructor resolves
16 * the collaborators by two different paths depending on whether $dao is the
17 * production ABJ_404_Solution_DataAccess or a subclass test double (see
18 * PluginLogic::__construct() if/else around the dao type check). Adding
19 * interface type hints here would break the subclass-double path because
20 * ABJ_404_Solution_DataAccess does not implement the repository interfaces
21 * (post-i266/i775/i758: typed surfaces are obtained via $dao->getLogsRepo(),
22 * $dao->getContentRepo(), etc.; the DataAccess facade itself no longer
23 * carries those pass-throughs). Its subclass doubles wear $dao as each
24 * repo without implementing those interfaces. The @var docblocks document
25 * the resolved-type intent for static analysis.
26 */
27 final class ABJ_404_Solution_AdminActionsDependencies {
28
29 /** @var ABJ_404_Solution_Functions */
30 private $f;
31 /** @var ABJ_404_Solution_Logging */
32 private $logger;
33 /** @var ABJ_404_Solution_RedirectsRepositoryInterface */
34 private $redirectsRepo;
35 /** @var ABJ_404_Solution_ViewReadServiceInterface */
36 private $viewRead;
37 /** @var ABJ_404_Solution_ContentRepositoryInterface */
38 private $contentRepo;
39 /** @var ABJ_404_Solution_DatabaseCoreInterface&ABJ_404_Solution_DatabaseQueryInterface */
40 private $dbCore;
41 /** @var ABJ_404_Solution_DataAccess */
42 private $dao;
43 /** @var ABJ_404_Solution_PluginLogicUrlNormalization */
44 private $urlNormalization;
45 /** @var ABJ_404_Solution_PluginLogic */
46 private $pluginLogic;
47 /** @var ABJ_404_Solution_PluginUpdateMetadataRepository|null */
48 private $pluginUpdateRepo;
49
50 /**
51 * @param ABJ_404_Solution_Functions $f
52 * @param ABJ_404_Solution_Logging $logger
53 * @param ABJ_404_Solution_RedirectsRepositoryInterface $redirectsRepo
54 * @param ABJ_404_Solution_ViewReadServiceInterface $viewRead
55 * @param ABJ_404_Solution_ContentRepositoryInterface $contentRepo
56 * @param ABJ_404_Solution_DatabaseCoreInterface&ABJ_404_Solution_DatabaseQueryInterface $dbCore
57 * @param ABJ_404_Solution_DataAccess $dao
58 * @param ABJ_404_Solution_PluginLogicUrlNormalization $urlNormalization
59 * @param ABJ_404_Solution_PluginLogic $pluginLogic
60 * @param ABJ_404_Solution_PluginUpdateMetadataRepository|null $pluginUpdateRepo
61 */
62 public function __construct(
63 $f,
64 $logger,
65 $redirectsRepo,
66 $viewRead,
67 $contentRepo,
68 $dbCore,
69 $dao,
70 $urlNormalization,
71 $pluginLogic,
72 $pluginUpdateRepo = null
73 ) {
74 $this->f = $f;
75 $this->logger = $logger;
76 $this->redirectsRepo = $redirectsRepo;
77 $this->viewRead = $viewRead;
78 $this->contentRepo = $contentRepo;
79 $this->dbCore = $dbCore;
80 $this->dao = $dao;
81 $this->urlNormalization = $urlNormalization;
82 $this->pluginLogic = $pluginLogic;
83 $this->pluginUpdateRepo = $pluginUpdateRepo;
84 }
85
86 /** @return ABJ_404_Solution_Functions */
87 public function getFunctions() { return $this->f; }
88
89 /** @return ABJ_404_Solution_Logging */
90 public function getLogger() { return $this->logger; }
91
92 /** @return ABJ_404_Solution_RedirectsRepositoryInterface */
93 public function getRedirectsRepo() { return $this->redirectsRepo; }
94
95 /** @return ABJ_404_Solution_ViewReadServiceInterface */
96 public function getViewRead() { return $this->viewRead; }
97
98 /** @return ABJ_404_Solution_ContentRepositoryInterface */
99 public function getContentRepo() { return $this->contentRepo; }
100
101 /** @return ABJ_404_Solution_DatabaseCoreInterface */
102 public function getDbCore() { return $this->dbCore; }
103
104 /** @return ABJ_404_Solution_DatabaseQueryInterface */
105 public function getDbQuery() { return $this->dbCore; }
106
107 /** @return ABJ_404_Solution_DataAccess */
108 public function getDao() { return $this->dao; }
109
110 /** @return ABJ_404_Solution_PluginLogicUrlNormalization */
111 public function getUrlNormalization() { return $this->urlNormalization; }
112
113 /** @return ABJ_404_Solution_PluginLogic */
114 public function getPluginLogic() { return $this->pluginLogic; }
115
116 /**
117 * Lazily resolves the repository when the bundle was constructed without
118 * one (legacy DI sites that don't yet pass it). Production paths register
119 * the service in bootstrap.php so the lookup hits the container.
120 *
121 * @return ABJ_404_Solution_PluginUpdateMetadataRepository
122 */
123 public function getPluginUpdateRepo() {
124 if ($this->pluginUpdateRepo === null) {
125 $resolved = abj_service('plugin_update_metadata_repository');
126 /** @var ABJ_404_Solution_PluginUpdateMetadataRepository $resolved */
127 $this->pluginUpdateRepo = $resolved;
128 }
129 return $this->pluginUpdateRepo;
130 }
131 }
132