5
5
use Bayfront \Bones \Abstracts \Service ;
6
6
use Bayfront \Bones \Application \Services \Events \EventService ;
7
7
use Bayfront \Bones \Application \Services \Filters \FilterService ;
8
- use Bayfront \Bones \Application \Utilities \App ;
9
8
use Bayfront \Bones \Exceptions \ServiceException ;
10
9
use Bayfront \BonesService \WebApp \Events \WebAppServiceEvents ;
11
10
use Bayfront \BonesService \WebApp \Exceptions \WebAppServiceException ;
12
11
use Bayfront \BonesService \WebApp \Filters \WebAppServiceFilters ;
13
- use Bayfront \Container \NotFoundException ;
14
12
use Bayfront \HttpResponse \Response ;
15
13
use Bayfront \RouteIt \Router ;
14
+ use Bayfront \Translation \Translate ;
16
15
use Bayfront \Veil \Veil ;
17
16
18
17
class WebAppService extends Service
@@ -22,6 +21,7 @@ class WebAppService extends Service
22
21
public FilterService $ filters ;
23
22
public Response $ response ;
24
23
public Router $ router ;
24
+ public Translate $ translate ;
25
25
public Veil $ veil ;
26
26
27
27
/**
@@ -32,30 +32,27 @@ class WebAppService extends Service
32
32
* @param FilterService $filters
33
33
* @param Response $response
34
34
* @param Router $router
35
+ * @param Translate $translate
35
36
* @param Veil $veil
36
37
* @throws WebAppServiceException
37
38
*/
38
39
39
- public function __construct (EventService $ events , FilterService $ filters , Response $ response , Router $ router , Veil $ veil )
40
+ public function __construct (EventService $ events , FilterService $ filters , Response $ response , Router $ router , Translate $ translate , Veil $ veil )
40
41
{
41
42
$ this ->events = $ events ;
42
43
$ this ->filters = $ filters ;
43
44
$ this ->response = $ response ;
44
45
$ this ->router = $ router ;
46
+ $ this ->translate = $ translate ;
45
47
$ this ->veil = $ veil ;
46
48
47
49
parent ::__construct ($ events );
48
50
49
- if (!App::has ('Bayfront\Translation\Translate ' )) {
50
- throw new WebAppServiceException ('Unable to start WebAppService: Required dependency not found (Bayfront\Translation\Translate) ' );
51
- }
52
-
53
51
// Enqueue events
54
52
55
53
try {
56
- $ translate = App::get ('Bayfront\Translation\Translate ' );
57
54
$ this ->events ->addSubscriptions (new WebAppServiceEvents ($ this , $ translate ));
58
- } catch (ServiceException | NotFoundException $ e ) {
55
+ } catch (ServiceException $ e ) {
59
56
throw new WebAppServiceException ('Unable to start WebAppService: ' . $ e ->getMessage (), $ e ->getCode (), $ e ->getPrevious ());
60
57
}
61
58
0 commit comments