AmplitudeProvider.php
2 months ago
AssetsProvider.php
11 months ago
BlocksProvider.php
3 months ago
ClientProvider.php
2 months ago
ContainerProvider.php
11 months ago
DatabaseProvider.php
8 months ago
HostingRoutesProvider.php
2 months ago
IntegrationsProvider.php
5 months ago
JobsProvider.php
7 months ago
MenusProvider.php
11 months ago
NoticesProvider.php
4 months ago
ProviderInterface.php
11 months ago
RedirectsProvider.php
11 months ago
RoutesProvider.php
9 months ago
SurveysProvider.php
2 months ago
TrackingProvider.php
8 months ago
WebhooksProvider.php
8 months ago
WpdbProvider.php
11 months ago
HostingRoutesProvider.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Hostinger\Reach\Providers; |
| 4 | |
| 5 | use Hostinger\Reach\Api\Handlers\HostingApiHandler; |
| 6 | use Hostinger\Reach\Api\Routes\HostingRoutes; |
| 7 | use Hostinger\Reach\Container; |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | die; |
| 11 | } |
| 12 | |
| 13 | class HostingRoutesProvider implements ProviderInterface { |
| 14 | public function register( Container $container ): void { |
| 15 | $routes = array( |
| 16 | HostingRoutes::class => array( |
| 17 | $container->get( HostingApiHandler::class ), |
| 18 | ), |
| 19 | ); |
| 20 | |
| 21 | foreach ( $routes as $class_name => $dependencies ) { |
| 22 | $router = new $class_name( ...$dependencies ); |
| 23 | $container->set( |
| 24 | $router::class, |
| 25 | function () use ( $router ) { |
| 26 | return $router; |
| 27 | } |
| 28 | ); |
| 29 | |
| 30 | $route = $container->get( $router::class ); |
| 31 | $route->init(); |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 |