71 lines
1.6 KiB
Plaintext
71 lines
1.6 KiB
Plaintext
|
/**
|
||
|
* 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')
|
||
|
);
|
||
|
}
|