Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function __construct(App $config)
$this->startTime = microtime(true);
$this->config = $config;

$this->pageCache = Services::responsecache();
$this->pageCache = service('responsecache');
}

/**
Expand Down Expand Up @@ -341,8 +341,12 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
$this->benchmark->stop('bootstrap');

$this->benchmark->start('required_before_filters');
// Start up the filters
$filters = Services::filters();
/**
* Start up the filters
*
* @var Filters $filters
*/
$filters = service('filters');
// Run required before filters
$possibleResponse = $this->runRequiredBeforeFilters($filters);

Expand All @@ -351,7 +355,7 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
$this->response = $possibleResponse;
} else {
try {
$this->response = $this->handleRequest($routes, config(Cache::class), $returnResponse);
$this->response = $this->handleRequest($routes, config(Cache::class), $filters);
} catch (ResponsableInterface $e) {
$this->outputBufferingEnd();

Expand Down Expand Up @@ -443,10 +447,8 @@ public function disableFilters(): void
*
* @throws PageNotFoundException
* @throws RedirectException
*
* @deprecated $returnResponse is deprecated.
*/
protected function handleRequest(?RouteCollectionInterface $routes, Cache $cacheConfig, bool $returnResponse = false)
protected function handleRequest(?RouteCollectionInterface $routes, Cache $cacheConfig, Filters $filters)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the param to Filters?

{
if ($this->request instanceof IncomingRequest && $this->request->getMethod() === 'CLI') {
return $this->response->setStatusCode(405)->setBody('Method Not Allowed');
Expand All @@ -458,9 +460,6 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache
$uri = $this->request->getPath();

if ($this->enableFilters) {
/** @var Filters $filters */
$filters = service('filters');

// If any filters were specified within the routes file,
// we need to ensure it's active for the current request
if ($routeFilters !== null) {
Expand Down Expand Up @@ -516,8 +515,6 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache
$this->gatherOutput($cacheConfig, $returned);

if ($this->enableFilters) {
/** @var Filters $filters */
$filters = service('filters');
$filters->setResponse($this->response);

// Run "after" filters
Expand Down Expand Up @@ -608,7 +605,7 @@ protected function startBenchmark()
$this->startTime = microtime(true);
}

$this->benchmark = Services::timer();
$this->benchmark = service('timer');
$this->benchmark->start('total_execution', $this->startTime);
$this->benchmark->start('bootstrap');
}
Expand Down Expand Up @@ -901,7 +898,7 @@ protected function createController()
assert(is_string($this->controller));

$class = new $this->controller();
$class->initController($this->request, $this->response, Services::logger());
$class->initController($this->request, $this->response, service('logger'));

$this->benchmark->stop('controller_constructor');

Expand Down
Loading