Skip to content

Commit

Permalink
fix functions
Browse files Browse the repository at this point in the history
  • Loading branch information
blat committed Aug 1, 2022
1 parent 29a6577 commit b1c086e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/PlatesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
*/
public function register(Engine $engine)
{
foreach (['urlFor', 'fullUrlFor', 'isCurrentUrl', 'getCurrentUrl', 'getBasePath'] as $name) {
foreach (['urlFor', 'fullUrlFor', 'isCurrentUrl', 'currentUrl', 'basePath'] as $name) {
$engine->registerFunction($name, [$this, $name]);
}
}
Expand Down Expand Up @@ -88,7 +88,7 @@ public function fullUrlFor(string $routeName, array $data = [], array $queryPara
*/
public function isCurrentUrl(string $routeName, array $data = []): bool
{
$currentUrl = $this->getBasePath() . $this->uri->getPath();
$currentUrl = $this->basePath() . $this->uri->getPath();
$result = $this->app->getRouteCollector()->getRouteParser()->urlFor($routeName, $data);

return $result === $currentUrl;
Expand All @@ -101,9 +101,9 @@ public function isCurrentUrl(string $routeName, array $data = []): bool
*
* @return string
*/
public function getCurrentUrl(bool $withQueryString = false): string
public function currentUrl(bool $withQueryString = false): string
{
$currentUrl = $this->getBasePath() . $this->uri->getPath();
$currentUrl = $this->basePath() . $this->uri->getPath();
$query = $this->uri->getQuery();

if ($withQueryString && !empty($query)) {
Expand All @@ -118,7 +118,7 @@ public function getCurrentUrl(bool $withQueryString = false): string
*
* @return string
*/
public function getBasePath(): string
public function basePath(): string
{
return $this->app->getBasePath();
}
Expand Down

0 comments on commit b1c086e

Please sign in to comment.