Skip to content

Commit fed0116

Browse files
committed
Fixed request property and added other properties.
1 parent c5905c4 commit fed0116

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

Application.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
use Codefy\Framework\Support\Paths;
88
use Psr\Container\ContainerInterface;
9-
use Psr\Http\Message\RequestInterface;
109
use Psr\Http\Message\ResponseInterface;
10+
use Psr\Http\Message\ServerRequestInterface;
1111
use Psr\SimpleCache\CacheInterface;
1212
use Qubus\Config\ConfigContainer;
1313
use Qubus\Dbal\Connection;
1414
use Qubus\Dbal\DB;
15+
use Qubus\EventDispatcher\EventDispatcher;
1516
use Qubus\Exception\Data\TypeException;
1617
use Qubus\Exception\Exception;
1718
use Qubus\Expressive\OrmBuilder;
@@ -25,6 +26,7 @@
2526
use Qubus\Injector\ServiceProvider\Bootable;
2627
use Qubus\Injector\ServiceProvider\Serviceable;
2728
use Qubus\Mail\Mailer;
29+
use Qubus\Routing\Router;
2830
use Qubus\Support\Assets;
2931

3032
use function Codefy\Framework\Helpers\env;
@@ -46,7 +48,9 @@ final class Application extends Container
4648

4749
public static ?Application $APP = null;
4850

49-
public readonly RequestInterface $request;
51+
public readonly Router $router;
52+
53+
public readonly ServerRequestInterface $request;
5054

5155
public readonly ResponseInterface $response;
5256

@@ -60,6 +64,8 @@ final class Application extends Container
6064

6165
public readonly Flash $flash;
6266

67+
public readonly EventDispatcher $event;
68+
6369
public string $charset = 'UTF-8';
6470

6571
public string $locale = 'en';
@@ -101,8 +107,10 @@ public function __construct(array $params)
101107
parent::__construct(InjectorFactory::create(config: $this->coreAliases()));
102108
$this->registerDefaultServiceProviders();
103109

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);
106114
/** @var $this ResponseInterface */
107115
$this->response = $this->make(name: ResponseInterface::class);
108116
/** @var $this Assets */
@@ -115,6 +123,8 @@ public function __construct(array $params)
115123
$this->session = $this->make(name: PhpSession::class);
116124
/** @var $this Flash */
117125
$this->flash = $this->make(name: Flash::class);
126+
/** @var $this EventDispatcher */
127+
$this->event = $this->make(name: EventDispatcher::class);
118128

119129
Codefy::$PHP = $this;
120130
}
@@ -134,7 +144,10 @@ public function getDbConnection(): Connection
134144
'host' => $config->getConfigKey(key: "database.connections.{$connection}.host", default: 'localhost'),
135145
'port' => $config->getConfigKey(key: "database.connections.{$connection}.port", default: 3306),
136146
'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+
),
138151
'username' => $config->getConfigKey(key: "database.connections.{$connection}.username"),
139152
'password' => $config->getConfigKey(key: "database.connections.{$connection}.password"),
140153
'dbname' => $config->getConfigKey(key: "database.connections.{$connection}.dbname"),
@@ -691,7 +704,7 @@ protected function coreAliases(): array
691704
\Qubus\Config\ConfigContainer::class => \Qubus\Config\Collection::class,
692705
\Qubus\EventDispatcher\EventDispatcher::class => \Qubus\EventDispatcher\Dispatcher::class,
693706
'mailer' => \Qubus\Mail\Mailer::class,
694-
'dir.path' => Support\Paths::class,
707+
'dir.path' => \Codefy\Framework\Support\Paths::class,
695708
'container' => self::class,
696709
'codefy' => self::class,
697710
\Qubus\Routing\Interfaces\Collector::class => \Qubus\Routing\Route\RouteCollector::class,
@@ -705,7 +718,8 @@ protected function coreAliases(): array
705718
=> \Codefy\Framework\Scheduler\Mutex\CacheLocker::class,
706719
\Psr\SimpleCache\CacheInterface::class => \Qubus\Cache\Psr16\SimpleCache::class,
707720
\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,
709723
\Symfony\Component\Console\Input\InputInterface::class
710724
=> \Symfony\Component\Console\Input\ArgvInput::class,
711725
\Symfony\Component\Console\Output\OutputInterface::class

0 commit comments

Comments
 (0)