-
Notifications
You must be signed in to change notification settings - Fork 0
/
Settings.php
123 lines (108 loc) · 3.04 KB
/
Settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/**
* @package vdm/gitea
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git VDM Gitea Library <https://git.vdm.dev/joomla/vdm-gitea>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VastDevelopmentMethod\Gitea\Joomla\Gitea\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VastDevelopmentMethod\Gitea\Joomla\Gitea\Settings\Api;
use VastDevelopmentMethod\Gitea\Joomla\Gitea\Settings\Attachment;
use VastDevelopmentMethod\Gitea\Joomla\Gitea\Settings\Repository;
use VastDevelopmentMethod\Gitea\Joomla\Gitea\Settings\Ui;
/**
* The Gitea Settings Service
*
* @since 3.2.0
*/
class Settings implements ServiceProviderInterface
{
/**
* 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(Api::class, 'Gitea.Settings.Api')
->share('Gitea.Settings.Api', [$this, 'getApi'], true);
$container->alias(Attachment::class, 'Gitea.Settings.Attachment')
->share('Gitea.Settings.Attachment', [$this, 'getAttachment'], true);
$container->alias(Repository::class, 'Gitea.Settings.Repository')
->share('Gitea.Settings.Repository', [$this, 'getRepository'], true);
$container->alias(Ui::class, 'Gitea.Settings.Ui')
->share('Gitea.Settings.Ui', [$this, 'getUi'], true);
}
/**
* Get the Api class
*
* @param Container $container The DI container.
*
* @return Api
* @since 3.2.0
*/
public function getApi(Container $container): Api
{
return new Api(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
/**
* Get the Attachment class
*
* @param Container $container The DI container.
*
* @return Attachment
* @since 3.2.0
*/
public function getAttachment(Container $container): Attachment
{
return new Attachment(
$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 Ui class
*
* @param Container $container The DI container.
*
* @return Ui
* @since 3.2.0
*/
public function getUi(Container $container): Ui
{
return new Ui(
$container->get('Gitea.Utilities.Http'),
$container->get('Gitea.Dynamic.Uri'),
$container->get('Gitea.Utilities.Response')
);
}
}