PluginProbe
404 Solution / 4.1.13
404 Solution v4.1.13
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 / MatchingEngine.php

MatchingEngine.php in 404 Solution 4.1.13, at includes/MatchingEngine.php

41 lines 1.2 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 * Interface for pluggable URL matching engines.
9 *
10 * Each engine represents one strategy for matching a 404 request to an existing page
11 * (e.g., slug lookup, spelling correction, title matching). The pipeline iterates
12 * engines in order; the first non-null result wins.
13 */
14 interface ABJ_404_Solution_MatchingEngine {
15
16 /**
17 * Human-readable name used in log entries and debug output.
18 *
19 * @return string
20 */
21 public function getName(): string;
22
23 /**
24 * Pre-flight check: should this engine even attempt a match?
25 *
26 * Return false to skip expensive work (e.g., empty slug, synthetic URL patterns).
27 *
28 * @param ABJ_404_Solution_MatchRequest $request
29 * @return bool
30 */
31 public function shouldRun(ABJ_404_Solution_MatchRequest $request): bool;
32
33 /**
34 * Attempt to find a matching page/post for the request.
35 *
36 * @param ABJ_404_Solution_MatchRequest $request
37 * @return ABJ_404_Solution_MatchResult|null Null means no match; pipeline tries next engine.
38 */
39 public function match(ABJ_404_Solution_MatchRequest $request): ?ABJ_404_Solution_MatchResult;
40 }
41