mirror of
https://github.com/flarum/core.git
synced 2025-10-17 17:56:14 +02:00
- Stop trying to implement Laravel's Application contract, which has no value for us. - Stop inheriting from the Container, injecting one works equally well and does not clutter up the interfaces. - Inject the Paths collection instead of unwrapping it again, for better encapsulation. This brings us one step closer toward upgrading our Laravel components (#2055), because we no longer need to adopt the changes to the Application contract.
34 lines
869 B
PHP
34 lines
869 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Flarum.
|
|
*
|
|
* For detailed copyright and license information, please view the
|
|
* LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Flarum\Formatter;
|
|
|
|
use Flarum\Foundation\AbstractServiceProvider;
|
|
use Illuminate\Cache\Repository;
|
|
use Illuminate\Contracts\Container\Container;
|
|
|
|
class FormatterServiceProvider extends AbstractServiceProvider
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function register()
|
|
{
|
|
$this->app->singleton('flarum.formatter', function (Container $container) {
|
|
return new Formatter(
|
|
new Repository($container->make('cache.filestore')),
|
|
$container->make('events'),
|
|
$this->app['flarum']->storagePath().'/formatter'
|
|
);
|
|
});
|
|
|
|
$this->app->alias('flarum.formatter', Formatter::class);
|
|
}
|
|
}
|