6
6
7
7
use Codefy \Framework \Support \Paths ;
8
8
use Psr \Container \ContainerInterface ;
9
- use Psr \Http \Message \RequestInterface ;
10
9
use Psr \Http \Message \ResponseInterface ;
10
+ use Psr \Http \Message \ServerRequestInterface ;
11
11
use Psr \SimpleCache \CacheInterface ;
12
12
use Qubus \Config \ConfigContainer ;
13
13
use Qubus \Dbal \Connection ;
14
14
use Qubus \Dbal \DB ;
15
+ use Qubus \EventDispatcher \EventDispatcher ;
15
16
use Qubus \Exception \Data \TypeException ;
16
17
use Qubus \Exception \Exception ;
17
18
use Qubus \Expressive \OrmBuilder ;
25
26
use Qubus \Injector \ServiceProvider \Bootable ;
26
27
use Qubus \Injector \ServiceProvider \Serviceable ;
27
28
use Qubus \Mail \Mailer ;
29
+ use Qubus \Routing \Router ;
28
30
use Qubus \Support \Assets ;
29
31
30
32
use function Codefy \Framework \Helpers \env ;
@@ -46,7 +48,9 @@ final class Application extends Container
46
48
47
49
public static ?Application $ APP = null ;
48
50
49
- public readonly RequestInterface $ request ;
51
+ public readonly Router $ router ;
52
+
53
+ public readonly ServerRequestInterface $ request ;
50
54
51
55
public readonly ResponseInterface $ response ;
52
56
@@ -60,6 +64,8 @@ final class Application extends Container
60
64
61
65
public readonly Flash $ flash ;
62
66
67
+ public readonly EventDispatcher $ event ;
68
+
63
69
public string $ charset = 'UTF-8 ' ;
64
70
65
71
public string $ locale = 'en ' ;
@@ -101,8 +107,10 @@ public function __construct(array $params)
101
107
parent ::__construct (InjectorFactory::create (config: $ this ->coreAliases ()));
102
108
$ this ->registerDefaultServiceProviders ();
103
109
104
- /** @var $this RequestInterface */
105
- $ this ->request = $ this ->make (name: RequestInterface::class);
110
+ /** @var $this Router */
111
+ $ this ->router = $ this ->make (name: 'router ' );
112
+ /** @var $this ServerRequestInterface */
113
+ $ this ->request = $ this ->make (name: ServerRequestInterface::class);
106
114
/** @var $this ResponseInterface */
107
115
$ this ->response = $ this ->make (name: ResponseInterface::class);
108
116
/** @var $this Assets */
@@ -115,6 +123,8 @@ public function __construct(array $params)
115
123
$ this ->session = $ this ->make (name: PhpSession::class);
116
124
/** @var $this Flash */
117
125
$ this ->flash = $ this ->make (name: Flash::class);
126
+ /** @var $this EventDispatcher */
127
+ $ this ->event = $ this ->make (name: EventDispatcher::class);
118
128
119
129
Codefy::$ PHP = $ this ;
120
130
}
@@ -134,7 +144,10 @@ public function getDbConnection(): Connection
134
144
'host ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.host " , default: 'localhost ' ),
135
145
'port ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.port " , default: 3306 ),
136
146
'charset ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.charset " , default: 'utf8mb4 ' ),
137
- 'collation ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.collation " , default: 'utf8mb4_unicode_ci ' ),
147
+ 'collation ' => $ config ->getConfigKey (
148
+ key: "database.connections. {$ connection }.collation " ,
149
+ default: 'utf8mb4_unicode_ci '
150
+ ),
138
151
'username ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.username " ),
139
152
'password ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.password " ),
140
153
'dbname ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.dbname " ),
@@ -691,7 +704,7 @@ protected function coreAliases(): array
691
704
\Qubus \Config \ConfigContainer::class => \Qubus \Config \Collection::class,
692
705
\Qubus \EventDispatcher \EventDispatcher::class => \Qubus \EventDispatcher \Dispatcher::class,
693
706
'mailer ' => \Qubus \Mail \Mailer::class,
694
- 'dir.path ' => Support \Paths::class,
707
+ 'dir.path ' => \ Codefy \ Framework \ Support \Paths::class,
695
708
'container ' => self ::class,
696
709
'codefy ' => self ::class,
697
710
\Qubus \Routing \Interfaces \Collector::class => \Qubus \Routing \Route \RouteCollector::class,
@@ -705,7 +718,8 @@ protected function coreAliases(): array
705
718
=> \Codefy \Framework \Scheduler \Mutex \CacheLocker::class,
706
719
\Psr \SimpleCache \CacheInterface::class => \Qubus \Cache \Psr16 \SimpleCache::class,
707
720
\Qubus \Http \Session \PhpSession::class => \Qubus \Http \Session \NativeSession::class,
708
- \DateTimeZone::class => \Qubus \Support \DateTime \QubusDateTimeZone::class,
721
+ \DateTimeInterface::class => \Qubus \Support \DateTime \QubusDateTimeImmutable::class,
722
+ \Qubus \Support \DateTime \Date::class => \Qubus \Support \DateTime \QubusDate::class,
709
723
\Symfony \Component \Console \Input \InputInterface::class
710
724
=> \Symfony \Component \Console \Input \ArgvInput::class,
711
725
\Symfony \Component \Console \Output \OutputInterface::class
0 commit comments