mirror of
https://github.com/flarum/core.git
synced 2025-10-13 16:05:05 +02:00
* Write source map without creating temp file Less I/O, and one less place where we access the global path helpers. * Drop useless app_path() helper This was probably taken straight from Laravel. There is no equivalent concept in Flarum, so this should be safe to remove. * Deprecate global path helpers Developers using these helpers can inject the `Paths` class instead. * Stop storing paths as strings in container * Avoid using path helpers from Application class * Deprecate path helpers from Application class * Avoid using public_path() in prerequisite check a) The comparison was already outdated, as a different path was passed. b) We're trying to get rid of these global helpers.
35 lines
896 B
PHP
35 lines
896 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 Flarum\Foundation\Paths;
|
|
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[Paths::class]->storage.'/formatter'
|
|
);
|
|
});
|
|
|
|
$this->app->alias('flarum.formatter', Formatter::class);
|
|
}
|
|
}
|