| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Resolves the stats repository for legacy construction paths. |
| 9 |
*/ |
| 10 |
class ABJ_404_Solution_StatsRepositoryResolver { |
| 11 |
|
| 12 |
/** |
| 13 |
* @return ABJ_404_Solution_StatsRepositoryInterface |
| 14 |
*/ |
| 15 |
public static function resolve(string $context = ''): ABJ_404_Solution_StatsRepositoryInterface { |
| 16 |
$service = class_exists('ABJ_404_Solution_ServiceContainer') |
| 17 |
? ABJ_404_Solution_ServiceContainer::safeGet('stats_repository') |
| 18 |
: null; |
| 19 |
if ($service instanceof ABJ_404_Solution_StatsRepositoryInterface) { |
| 20 |
return $service; |
| 21 |
} |
| 22 |
|
| 23 |
return new ABJ_404_Solution_UnavailableStatsRepository($context); |
| 24 |
} |
| 25 |
} |
| 26 |
|