gitea/src/808da4eb-b467-46cf-a767-e7e714f46b5a/code.power

71 lines
1.6 KiB
Plaintext
Raw Normal View History

2023-04-15 15:08:07 +00:00
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Pack::class, 'Gitea.Package')
->share('Gitea.Package', [$this, 'getPackage'], true);
$container->alias(Files::class, 'Gitea.Package.Files')
->share('Gitea.Package.Files', [$this, 'getFiles'], true);
$container->alias(Owner::class, 'Gitea.Package.Owner')
->share('Gitea.Package.Owner', [$this, 'getOwner'], true);
}
/**
* Get the Package class
*
* @param Container $container The DI container.
*
* @return Pack
* @since 3.2.0
*/
public function getPackage(Container $container): Pack
{
return new Pack(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Files class
*
* @param Container $container The DI container.
*
* @return Files
* @since 3.2.0
*/
public function getFiles(Container $container): Files
{
return new Files(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Owner class
*
* @param Container $container The DI container.
*
* @return Owner
* @since 3.2.0
*/
public function getOwner(Container $container): Owner
{
return new Owner(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}