Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Commit 7848962

Browse files
committed
naming changed [skip ci]
1 parent f127729 commit 7848962

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/Dispatcher.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Dispatcher
3030
/**
3131
* @var null|string
3232
*/
33-
private $cachedFile;
33+
private $cacheFile;
3434

3535
/**
3636
* @var array
@@ -43,11 +43,11 @@ class Dispatcher
4343
FastRoute\Dispatcher::NOT_FOUND => 404
4444
];
4545

46-
public function __construct(array $routes, int $defaultReturnType, ?string $cachedFile)
46+
public function __construct(array $routes, int $defaultReturnType, ?string $cacheFile)
4747
{
4848
$this->routes = $routes;
4949
$this->defaultReturnType = $defaultReturnType;
50-
$this->cachedFile = $cachedFile;
50+
$this->cacheFile = $cacheFile;
5151
}
5252

5353
/*
@@ -56,7 +56,7 @@ public function __construct(array $routes, int $defaultReturnType, ?string $cac
5656
public function dispatcher() : FastRoute\Dispatcher
5757
{
5858
$this->setRouteClosures();
59-
if ($this->cachedFile !== null && file_exists($this->cachedFile)) {
59+
if ($this->cacheFile !== null && file_exists($this->cacheFile)) {
6060
return $this->cachedDispatcher();
6161
}
6262
/**
@@ -73,20 +73,20 @@ public function dispatcher() : FastRoute\Dispatcher
7373

7474
private function createCachedRoute($routeCollector) : void
7575
{
76-
if ($this->cachedFile !== null && !file_exists($this->cachedFile)) {
76+
if ($this->cacheFile !== null && !file_exists($this->cacheFile)) {
7777
/**
7878
* @var FastRoute\RouteCollector $routeCollector
7979
*/
8080
$dispatchData = $routeCollector->getData();
81-
file_put_contents($this->cachedFile, '<?php return ' . var_export($dispatchData, true) . ';', LOCK_EX);
81+
file_put_contents($this->cacheFile, '<?php return ' . var_export($dispatchData, true) . ';', LOCK_EX);
8282
}
8383
}
8484

8585
private function cachedDispatcher() : FastRoute\Dispatcher\GroupCountBased
8686
{
87-
$dispatchData = include $this->cachedFile;
87+
$dispatchData = require $this->cacheFile;
8888
if (!is_array($dispatchData)) {
89-
throw new InvalidCacheFileException('Invalid cache file "' . $this->cachedFile . '"');
89+
throw new InvalidCacheFileException('Invalid cache file "' . $this->cacheFile . '"');
9090
}
9191
return new FastRoute\Dispatcher\GroupCountBased($dispatchData);
9292
}

src/Router.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ final class Router
8181
/**
8282
* @var null|string
8383
*/
84-
private $cachedFile;
84+
private $cacheFile;
8585

8686
/**
8787
* Valid Request Methods array.
@@ -135,7 +135,7 @@ public function withSubFolder(string $folder) : self
135135
public function withCacheFile(string $fileName) : self
136136
{
137137
$new = clone $this;
138-
$new->cachedFile = $fileName;
138+
$new->cacheFile = $fileName;
139139
return $new;
140140
}
141141

@@ -203,7 +203,7 @@ private function checkRequestMethodIsValid(string $requestMethod) : void
203203

204204
public function getRoute() : Route
205205
{
206-
$selamiDispatcher = new Dispatcher($this->routes, $this->defaultReturnType, $this->cachedFile);
206+
$selamiDispatcher = new Dispatcher($this->routes, $this->defaultReturnType, $this->cacheFile);
207207
$routeInfo = $selamiDispatcher->dispatcher()
208208
->dispatch($this->method, $this->requestedPath);
209209
return $selamiDispatcher->runDispatcher($routeInfo)

0 commit comments

Comments
 (0)