PluginProbe
404 Solution / 4.3.0
404 Solution v4.3.0
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 / logs / RedirectHitLogEntry.php

RedirectHitLogEntry.php in 404 Solution 4.3.0, at includes/logs/RedirectHitLogEntry.php

63 lines 2.3 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 * 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