| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Parameter object describing a single redirect / 404 hit to be logged, |
| 9 |
* passed to {@see ABJ_404_Solution_LogWriteInterface::logRedirectHit()}. |
| 10 |
* |
| 11 |
* Replaces a 5-positional-parameter method signature (criterion 220 |
| 12 |
* Interface Size) across the interface, its implementations, and the |
| 13 |
* duck-typed call_user_func forwarders. Plain data carrier read directly by |
| 14 |
* the writer; use {@see self::create()} at call sites. |
| 15 |
*/ |
| 16 |
// allow-no-test-found: pure parameter-object DTO (typed public fields; create() factory only forwards to the constructor, no behavior); fields consumed by LogWriteInterface::logRedirectHit(), exercised in FrontendRedirect404PipelineEndToEndTest and LogQueueTest. |
| 17 |
class ABJ_404_Solution_RedirectHitLogEntry { |
| 18 |
|
| 19 |
/** @var string */ |
| 20 |
public string $requestedUrl; |
| 21 |
|
| 22 |
/** @var string */ |
| 23 |
public string $action; |
| 24 |
|
| 25 |
/** @var string */ |
| 26 |
public string $matchReason; |
| 27 |
|
| 28 |
/** @var string|null */ |
| 29 |
public ?string $requestedUrlDetail; |
| 30 |
|
| 31 |
/** @var list<array{step: string, outcome: string, detail: string}>|null */ |
| 32 |
public ?array $pipelineTrace; |
| 33 |
|
| 34 |
/** |
| 35 |
* @param string $requestedUrl |
| 36 |
* @param string $action |
| 37 |
* @param string $matchReason |
| 38 |
* @param string|null $requestedUrlDetail |
| 39 |
* @param list<array{step: string, outcome: string, detail: string}>|null $pipelineTrace |
| 40 |
*/ |
| 41 |
public function __construct(string $requestedUrl, string $action, string $matchReason, |
| 42 |
?string $requestedUrlDetail = null, ?array $pipelineTrace = null) { |
| 43 |
$this->requestedUrl = $requestedUrl; |
| 44 |
$this->action = $action; |
| 45 |
$this->matchReason = $matchReason; |
| 46 |
$this->requestedUrlDetail = $requestedUrlDetail; |
| 47 |
$this->pipelineTrace = $pipelineTrace; |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* @param string $requestedUrl |
| 52 |
* @param string $action |
| 53 |
* @param string $matchReason |
| 54 |
* @param string|null $requestedUrlDetail |
| 55 |
* @param list<array{step: string, outcome: string, detail: string}>|null $pipelineTrace |
| 56 |
* @return self |
| 57 |
*/ |
| 58 |
public static function create(string $requestedUrl, string $action, string $matchReason, |
| 59 |
?string $requestedUrlDetail = null, ?array $pipelineTrace = null): self { |
| 60 |
return new self($requestedUrl, $action, $matchReason, $requestedUrlDetail, $pipelineTrace); |
| 61 |
} |
| 62 |
} |
| 63 |
|