From b123e435ff4b83b60959983dad0de4f60ca6d38d Mon Sep 17 00:00:00 2001 From: Albert221 Date: Tue, 12 Jan 2016 22:07:47 +0100 Subject: [PATCH] Unified two URL prefix variables into one --- src/Admin/UrlGenerator.php | 3 +++ src/Api/UrlGenerator.php | 2 +- src/Http/AbstractUrlGenerator.php | 13 +------------ 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/Admin/UrlGenerator.php b/src/Admin/UrlGenerator.php index d317d1acf..b58c48faa 100644 --- a/src/Admin/UrlGenerator.php +++ b/src/Admin/UrlGenerator.php @@ -14,5 +14,8 @@ use Flarum\Http\AbstractUrlGenerator; class UrlGenerator extends AbstractUrlGenerator { + /** + * {@inheritdoc} + */ protected $path = 'admin'; } diff --git a/src/Api/UrlGenerator.php b/src/Api/UrlGenerator.php index 003d2d607..539003fb6 100644 --- a/src/Api/UrlGenerator.php +++ b/src/Api/UrlGenerator.php @@ -17,5 +17,5 @@ class UrlGenerator extends AbstractUrlGenerator /** * {@inheritdoc} */ - protected $prefix = 'api'; + protected $path = 'api'; } diff --git a/src/Http/AbstractUrlGenerator.php b/src/Http/AbstractUrlGenerator.php index 1d0426984..e1ededd54 100644 --- a/src/Http/AbstractUrlGenerator.php +++ b/src/Http/AbstractUrlGenerator.php @@ -30,11 +30,6 @@ class AbstractUrlGenerator */ protected $path; - /** - * @var string - */ - protected $prefix = ''; - /** * @param Application $app * @param RouteCollection $routes @@ -78,12 +73,6 @@ class AbstractUrlGenerator */ public function toBase() { - $base = $this->app->url($this->path); - - if (empty($this->prefix)) { - return $base; - } else { - return $base . '/' . $this->prefix; - } + return $this->app->url($this->path); } }