Create new Flarum\Frontend namespace

It replaces the old Http\WebApp namespace and swallows other namespaces
and files, such as Flarum\Asset.
This commit is contained in:
Franz Liedke 2017-06-24 11:52:53 +02:00
parent 6268c3010f
commit 0be13d50bd
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4
22 changed files with 84 additions and 86 deletions

View File

@ -84,7 +84,7 @@ class AdminServiceProvider extends AbstractServiceProvider
}
/**
* @return \Flarum\Http\WebApp\WebAppAssets
* @return \Flarum\Frontend\FrontendAssets
*/
protected function getWebAppAssets()
{

View File

@ -15,12 +15,12 @@ use Flarum\Admin\Frontend;
use Flarum\Core\Permission;
use Flarum\Event\PrepareUnserializedSettings;
use Flarum\Extension\ExtensionManager;
use Flarum\Http\Controller\AbstractWebAppController;
use Flarum\Frontend\AbstractFrontendController;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Events\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;
class FrontendController extends AbstractWebAppController
class FrontendController extends AbstractFrontendController
{
/**
* @var SettingsRepositoryInterface

View File

@ -11,9 +11,9 @@
namespace Flarum\Admin;
use Flarum\Http\WebApp\AbstractWebApp;
use Flarum\Frontend\AbstractFrontend;
class Frontend extends AbstractWebApp
class Frontend extends AbstractFrontend
{
/**
* {@inheritdoc}

View File

@ -12,20 +12,20 @@
namespace Flarum\Event;
use Flarum\Admin\Controller\FrontendController as AdminWebAppController;
use Flarum\Forum\Controller\WebAppController as ForumWebAppController;
use Flarum\Http\Controller\AbstractWebAppController;
use Flarum\Http\WebApp\WebAppView;
use Flarum\Forum\Controller\FrontendController as ForumWebAppController;
use Flarum\Frontend\AbstractFrontendController;
use Flarum\Frontend\FrontendView;
use Psr\Http\Message\ServerRequestInterface;
class ConfigureWebApp
{
/**
* @var AbstractWebAppController
* @var AbstractFrontendController
*/
public $controller;
/**
* @var WebAppView
* @var FrontendView
*/
public $view;
@ -35,11 +35,11 @@ class ConfigureWebApp
public $request;
/**
* @param AbstractWebAppController $controller
* @param WebAppView $view
* @param AbstractFrontendController $controller
* @param FrontendView $view
* @param ServerRequestInterface $request
*/
public function __construct(AbstractWebAppController $controller, WebAppView $view, ServerRequestInterface $request)
public function __construct(AbstractFrontendController $controller, FrontendView $view, ServerRequestInterface $request)
{
$this->controller = $controller;
$this->view = $view;

View File

@ -14,7 +14,7 @@ namespace Flarum\Forum\Controller;
use Flarum\Core\Exception\PermissionDeniedException;
use Psr\Http\Message\ServerRequestInterface as Request;
class AuthorizedWebAppController extends WebAppController
class AuthorizedWebAppController extends FrontendController
{
/**
* {@inheritdoc}

View File

@ -14,12 +14,12 @@ namespace Flarum\Forum\Controller;
use Flarum\Api\Client;
use Flarum\Core\User;
use Flarum\Forum\UrlGenerator;
use Flarum\Forum\WebApp;
use Flarum\Forum\Frontend;
use Flarum\Http\Exception\RouteNotFoundException;
use Illuminate\Contracts\Events\Dispatcher;
use Psr\Http\Message\ServerRequestInterface as Request;
class DiscussionController extends WebAppController
class DiscussionController extends FrontendController
{
/**
* @var ApiClient
@ -34,7 +34,7 @@ class DiscussionController extends WebAppController
/**
* {@inheritdoc}
*/
public function __construct(WebApp $webApp, Dispatcher $events, Client $api, UrlGenerator $url)
public function __construct(Frontend $webApp, Dispatcher $events, Client $api, UrlGenerator $url)
{
parent::__construct($webApp, $events);

View File

@ -13,11 +13,11 @@ namespace Flarum\Forum\Controller;
use Flarum\Api\Client as ApiClient;
use Flarum\Core\User;
use Flarum\Forum\WebApp;
use Flarum\Forum\Frontend;
use Illuminate\Contracts\Events\Dispatcher;
use Psr\Http\Message\ServerRequestInterface as Request;
class IndexController extends WebAppController
class IndexController extends FrontendController
{
/**
* @var ApiClient
@ -39,7 +39,7 @@ class IndexController extends WebAppController
/**
* {@inheritdoc}
*/
public function __construct(WebApp $webApp, Dispatcher $events, ApiClient $api)
public function __construct(Frontend $webApp, Dispatcher $events, ApiClient $api)
{
parent::__construct($webApp, $events);

View File

@ -11,16 +11,16 @@
namespace Flarum\Forum\Controller;
use Flarum\Forum\WebApp;
use Flarum\Http\Controller\AbstractWebAppController;
use Flarum\Forum\Frontend;
use Flarum\Frontend\AbstractFrontendController;
use Illuminate\Contracts\Events\Dispatcher;
class WebAppController extends AbstractWebAppController
class FrontendController extends AbstractFrontendController
{
/**
* {@inheritdoc}
*/
public function __construct(WebApp $webApp, Dispatcher $events)
public function __construct(Frontend $webApp, Dispatcher $events)
{
$this->webApp = $webApp;
$this->events = $events;

View File

@ -73,7 +73,7 @@ class ForumServiceProvider extends AbstractServiceProvider
$routes->get(
'/u/{username}[/{filter:[^/]*}]',
'user',
$route->toController(Controller\WebAppController::class)
$route->toController(Controller\FrontendController::class)
);
$routes->get(
@ -164,10 +164,10 @@ class ForumServiceProvider extends AbstractServiceProvider
}
/**
* @return \Flarum\Http\WebApp\WebAppAssets
* @return \Flarum\Frontend\FrontendAssets
*/
protected function getWebAppAssets()
{
return $this->app->make(WebApp::class)->getAssets();
return $this->app->make(Frontend::class)->getAssets();
}
}

View File

@ -12,13 +12,13 @@
namespace Flarum\Forum;
use Flarum\Formatter\Formatter;
use Flarum\Http\WebApp\AbstractWebApp;
use Flarum\Http\WebApp\WebAppAssetsFactory;
use Flarum\Http\WebApp\WebAppViewFactory;
use Flarum\Frontend\AbstractFrontend;
use Flarum\Frontend\FrontendAssetsFactory;
use Flarum\Frontend\FrontendViewFactory;
use Flarum\Locale\LocaleManager;
use Flarum\Settings\SettingsRepositoryInterface;
class WebApp extends AbstractWebApp
class Frontend extends AbstractFrontend
{
/**
* @var Formatter
@ -29,8 +29,8 @@ class WebApp extends AbstractWebApp
* {@inheritdoc}
*/
public function __construct(
WebAppAssetsFactory $assets,
WebAppViewFactory $view,
FrontendAssetsFactory $assets,
FrontendViewFactory $view,
SettingsRepositoryInterface $settings,
LocaleManager $locales,
Formatter $formatter

View File

@ -13,7 +13,7 @@ namespace Flarum\Foundation\Console;
use Flarum\Admin\Frontend as AdminWebApp;
use Flarum\Console\AbstractCommand;
use Flarum\Forum\WebApp as ForumWebApp;
use Flarum\Forum\Frontend as ForumWebApp;
use Illuminate\Contracts\Cache\Store;
class CacheClearCommand extends AbstractCommand
@ -24,7 +24,7 @@ class CacheClearCommand extends AbstractCommand
protected $cache;
/**
* @var \Flarum\Forum\WebApp
* @var \Flarum\Forum\Frontend
*/
protected $forum;

View File

@ -9,20 +9,20 @@
* file that was distributed with this source code.
*/
namespace Flarum\Http\WebApp;
namespace Flarum\Frontend;
use Flarum\Locale\LocaleManager;
use Flarum\Settings\SettingsRepositoryInterface;
abstract class AbstractWebApp
abstract class AbstractFrontend
{
/**
* @var WebAppAssetsFactory
* @var FrontendAssetsFactory
*/
protected $assets;
/**
* @var WebAppViewFactory
* @var FrontendViewFactory
*/
protected $view;
@ -37,12 +37,12 @@ abstract class AbstractWebApp
protected $locales;
/**
* @param WebAppAssetsFactory $assets
* @param WebAppViewFactory $view
* @param FrontendAssetsFactory $assets
* @param FrontendViewFactory $view
* @param SettingsRepositoryInterface $settings
* @param LocaleManager $locales
*/
public function __construct(WebAppAssetsFactory $assets, WebAppViewFactory $view, SettingsRepositoryInterface $settings, LocaleManager $locales)
public function __construct(FrontendAssetsFactory $assets, FrontendViewFactory $view, SettingsRepositoryInterface $settings, LocaleManager $locales)
{
$this->assets = $assets;
$this->view = $view;
@ -51,7 +51,7 @@ abstract class AbstractWebApp
}
/**
* @return WebAppView
* @return FrontendView
*/
public function getView()
{
@ -65,7 +65,7 @@ abstract class AbstractWebApp
}
/**
* @return WebAppAssets
* @return FrontendAssets
*/
public function getAssets()
{
@ -100,9 +100,9 @@ abstract class AbstractWebApp
}
/**
* @param WebAppView $view
* @param FrontendView $view
*/
private function addDefaultAssets(WebAppView $view)
private function addDefaultAssets(FrontendView $view)
{
$root = __DIR__.'/../../..';
$name = $this->getName();
@ -112,9 +112,9 @@ abstract class AbstractWebApp
}
/**
* @param WebAppView $view
* @param FrontendView $view
*/
private function addCustomLess(WebAppView $view)
private function addCustomLess(FrontendView $view)
{
$css = $view->getCss();
$localeCss = $view->getLocaleCss();
@ -154,9 +154,9 @@ abstract class AbstractWebApp
}
/**
* @param WebAppView $view
* @param FrontendView $view
*/
private function addTranslations(WebAppView $view)
private function addTranslations(FrontendView $view)
{
$translations = array_get($this->locales->getTranslator()->getMessages(), 'messages', []);

View File

@ -9,18 +9,18 @@
* file that was distributed with this source code.
*/
namespace Flarum\Http\Controller;
namespace Flarum\Frontend;
use Flarum\Event\ConfigureClientView;
use Flarum\Event\ConfigureWebApp;
use Flarum\Http\WebApp\AbstractWebApp;
use Flarum\Http\Controller\AbstractHtmlController;
use Illuminate\Contracts\Events\Dispatcher;
use Psr\Http\Message\ServerRequestInterface as Request;
abstract class AbstractWebAppController extends AbstractHtmlController
abstract class AbstractFrontendController extends AbstractHtmlController
{
/**
* @var AbstractWebApp
* @var AbstractFrontend
*/
protected $webApp;
@ -48,7 +48,7 @@ abstract class AbstractWebAppController extends AbstractHtmlController
/**
* @param Request $request
* @return \Flarum\Http\WebApp\WebAppView
* @return \Flarum\Frontend\FrontendView
*/
protected function getView(Request $request)
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Asset;
namespace Flarum\Frontend\Asset;
interface CompilerInterface
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Asset;
namespace Flarum\Frontend\Asset;
use Exception;
use Illuminate\Cache\Repository;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Asset;
namespace Flarum\Frontend\Asset;
use Less_Exception_Parser;
use Less_Parser;

View File

@ -9,11 +9,9 @@
* file that was distributed with this source code.
*/
namespace Flarum\Locale;
namespace Flarum\Frontend\Asset;
use Flarum\Asset\JsCompiler as BaseJsCompiler;
class JsCompiler extends BaseJsCompiler
class LocaleJsCompiler extends JsCompiler
{
protected $translations = [];

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Asset;
namespace Flarum\Frontend\Asset;
class RevisionCompiler implements CompilerInterface
{

View File

@ -9,16 +9,16 @@
* file that was distributed with this source code.
*/
namespace Flarum\Http\WebApp;
namespace Flarum\Frontend;
use Flarum\Asset\JsCompiler;
use Flarum\Asset\LessCompiler;
use Flarum\Frontend\Asset\JsCompiler;
use Flarum\Frontend\Asset\LessCompiler;
use Flarum\Foundation\Application;
use Flarum\Locale\JsCompiler as LocaleJsCompiler;
use Flarum\Frontend\Asset\LocaleJsCompiler as LocaleJsCompiler;
use Flarum\Locale\LocaleManager;
use Illuminate\Contracts\Cache\Repository;
class WebAppAssets
class FrontendAssets
{
/**
* @var string

View File

@ -9,13 +9,13 @@
* file that was distributed with this source code.
*/
namespace Flarum\Http\WebApp;
namespace Flarum\Frontend;
use Flarum\Foundation\Application;
use Flarum\Locale\LocaleManager;
use Illuminate\Contracts\Cache\Repository;
class WebAppAssetsFactory
class FrontendAssetsFactory
{
/**
* @var Application
@ -46,10 +46,10 @@ class WebAppAssetsFactory
/**
* @param string $name
* @return WebAppAssets
* @return FrontendAssets
*/
public function make($name)
{
return new WebAppAssets($name, $this->app, $this->cache, $this->locales);
return new FrontendAssets($name, $this->app, $this->cache, $this->locales);
}
}

View File

@ -9,13 +9,13 @@
* file that was distributed with this source code.
*/
namespace Flarum\Http\WebApp;
namespace Flarum\Frontend;
use Flarum\Api\Client;
use Flarum\Api\Serializer\AbstractSerializer;
use Flarum\Asset\CompilerInterface;
use Flarum\Frontend\Asset\CompilerInterface;
use Flarum\Foundation\Application;
use Flarum\Locale\JsCompiler;
use Flarum\Frontend\Asset\LocaleJsCompiler;
use Flarum\Locale\LocaleManager;
use Illuminate\View\Factory;
use Psr\Http\Message\ServerRequestInterface as Request;
@ -25,7 +25,7 @@ use Tobscure\JsonApi\Resource;
/**
* This class represents a view which boots up Flarum's client.
*/
class WebAppView
class FrontendView
{
/**
* The title of the document, displayed in the <title> tag.
@ -135,7 +135,7 @@ class WebAppView
protected $localeCss;
/**
* @var WebAppAssets
* @var FrontendAssets
*/
protected $assets;
@ -166,14 +166,14 @@ class WebAppView
/**
* @param string $layout
* @param WebAppAssets $assets
* @param FrontendAssets $assets
* @param Client $api
* @param Factory $view
* @param LocaleManager $locales
* @param AbstractSerializer $userSerializer
* @param Application $app
*/
public function __construct($layout, WebAppAssets $assets, Client $api, Factory $view, LocaleManager $locales, AbstractSerializer $userSerializer, Application $app)
public function __construct($layout, FrontendAssets $assets, Client $api, Factory $view, LocaleManager $locales, AbstractSerializer $userSerializer, Application $app)
{
$this->layout = $layout;
$this->api = $api;
@ -397,7 +397,7 @@ class WebAppView
}
/**
* @return JsCompiler
* @return LocaleJsCompiler
*/
public function getLocaleJs()
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Http\WebApp;
namespace Flarum\Frontend;
use Flarum\Api\Client;
use Flarum\Api\Serializer\CurrentUserSerializer;
@ -17,7 +17,7 @@ use Flarum\Foundation\Application;
use Flarum\Locale\LocaleManager;
use Illuminate\Contracts\View\Factory;
class WebAppViewFactory
class FrontendViewFactory
{
/**
* @var Client
@ -62,11 +62,11 @@ class WebAppViewFactory
/**
* @param string $layout
* @param WebAppAssets $assets
* @return WebAppView
* @param FrontendAssets $assets
* @return FrontendView
*/
public function make($layout, WebAppAssets $assets)
public function make($layout, FrontendAssets $assets)
{
return new WebAppView($layout, $assets, $this->api, $this->view, $this->locales, $this->userSerializer, $this->app);
return new FrontendView($layout, $assets, $this->api, $this->view, $this->locales, $this->userSerializer, $this->app);
}
}