Skip to content

Commit

Permalink
Cleanup DI definition
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioheleno committed Feb 15, 2024
1 parent 993a018 commit b18fbfc
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions config/dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
declare(strict_types = 1);

use DI\ContainerBuilder;
use GuzzleHttp\Client;
use Iodev\Whois\Factory;
use Iodev\Whois\Whois;
use Juanparati\RDAPLib\RDAPClient;
use Ocsp\CertificateInfo;
use Ocsp\CertificateLoader;
Expand All @@ -12,6 +12,7 @@
use Psr\Container\ContainerInterface;
use Symfony\Component\Clock\NativeClock;
use Watchr\Console\Services\CertificateService;
use Watchr\Console\Services\DomainService;
use Watchr\Console\Services\HttpService;

return static function (ContainerBuilder $builder): void {
Expand All @@ -27,6 +28,15 @@
new Ocsp()
);
},
DomainService::class => static function (ContainerInterface $container): DomainService {
return new DomainService(
new RDAPClient(
['domain' => 'https://rdap.org/domain/'],
new Client()
),
Factory::get()->createWhois()
);
},
ClockInterface::class => static function (ContainerInterface $container): ClockInterface {
return new NativeClock();
},
Expand All @@ -36,12 +46,6 @@
120,
sprintf('watchr (PHP %s; %s)', PHP_VERSION, PHP_OS_FAMILY)
);
},
RDAPClient::class => static function (ContainerInterface $container): RDAPClient {
return new RDAPClient(['domain' => 'https://rdap.org/domain/']);
},
Whois::class => static function (ContainerInterface $container): Whois {
return Factory::get()->createWhois();
}
]
);
Expand Down

0 comments on commit b18fbfc

Please sign in to comment.