| 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 |
|