mirror of
https://github.com/flarum/core.git
synced 2025-10-19 02:36:08 +02:00
Change order of bootstrapping
See commit on flarum/flarum for explanation
This commit is contained in:
@@ -1,22 +1,9 @@
|
||||
<?php namespace Flarum\Support;
|
||||
|
||||
use Flarum\Extend\ExtenderInterface;
|
||||
use Illuminate\Support\ServiceProvider as IlluminateServiceProvider;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class ServiceProvider extends IlluminateServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->extend($this->extenders());
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
@@ -25,32 +12,4 @@ class ServiceProvider extends IlluminateServiceProvider
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ExtenderInterface[]
|
||||
*/
|
||||
public function extenders()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ExtenderInterface|ExtenderInterface[] $extenders
|
||||
* @return void
|
||||
*/
|
||||
protected function extend($extenders)
|
||||
{
|
||||
if (! is_array($extenders)) {
|
||||
$extenders = [$extenders];
|
||||
}
|
||||
|
||||
foreach ($extenders as $extender) {
|
||||
if (! $extender instanceof ExtenderInterface) {
|
||||
throw new InvalidArgumentException('Argument must be an object of type '
|
||||
. ExtenderInterface::class);
|
||||
}
|
||||
|
||||
$extender->extend($this->app);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user