71 lines
1.8 KiB
Plaintext
71 lines
1.8 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(Notifi::class, 'Gitea.Notifications')
|
|
->share('Gitea.Notifications', [$this, 'getNotifications'], true);
|
|
|
|
$container->alias(Repository::class, 'Gitea.Notifications.Repository')
|
|
->share('Gitea.Notifications.Repository', [$this, 'getRepository'], true);
|
|
|
|
$container->alias(Thread::class, 'Gitea.Notifications.Thread')
|
|
->share('Gitea.Notifications.Thread', [$this, 'getThread'], true);
|
|
}
|
|
|
|
/**
|
|
* Get the Notifications class
|
|
*
|
|
* @param Container $container The DI container.
|
|
*
|
|
* @return Notifi
|
|
* @since 3.2.0
|
|
*/
|
|
public function getNotifications(Container $container): Notifi
|
|
{
|
|
return new Notifi(
|
|
$container->get('Gitea.Utilities.Http'),
|
|
$container->get('Gitea.Dynamic.Uri'),
|
|
$container->get('Gitea.Utilities.Response')
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the Repository class
|
|
*
|
|
* @param Container $container The DI container.
|
|
*
|
|
* @return Repository
|
|
* @since 3.2.0
|
|
*/
|
|
public function getRepository(Container $container): Repository
|
|
{
|
|
return new Repository(
|
|
$container->get('Gitea.Utilities.Http'),
|
|
$container->get('Gitea.Dynamic.Uri'),
|
|
$container->get('Gitea.Utilities.Response')
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the Thread class
|
|
*
|
|
* @param Container $container The DI container.
|
|
*
|
|
* @return Thread
|
|
* @since 3.2.0
|
|
*/
|
|
public function getThread(Container $container): Thread
|
|
{
|
|
return new Thread(
|
|
$container->get('Gitea.Utilities.Http'),
|
|
$container->get('Gitea.Dynamic.Uri'),
|
|
$container->get('Gitea.Utilities.Response')
|
|
);
|
|
}
|