Skip to content

Commit 7398226

Browse files
Cleanup the service provider
1 parent 128cac3 commit 7398226

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/HTMLMinServiceProvider.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
namespace GrahamCampbell\HTMLMin;
1818

19+
use Illuminate\Contracts\Foundation\Application;
1920
use Illuminate\Support\ServiceProvider;
2021
use Illuminate\View\Engines\CompilerEngine;
2122

@@ -44,14 +45,12 @@ public function boot()
4445
{
4546
$this->package('graham-campbell/htmlmin', 'graham-campbell/htmlmin', __DIR__);
4647

47-
// setup blade optimisations if enabled
4848
if ($this->app['config']['graham-campbell/htmlmin::blade']) {
49-
$this->enableBladeOptimisations();
49+
$this->enableBladeOptimisations($this->app);
5050
}
5151

52-
// setup live optimisations if enabled
5352
if ($this->app['config']['graham-campbell/htmlmin::live']) {
54-
$this->enableLiveOptimisations();
53+
$this->enableLiveOptimisations($this->app);
5554
}
5655

5756
$this->setupFilters();
@@ -60,33 +59,30 @@ public function boot()
6059
/**
6160
* Enable blade optimisations.
6261
*
62+
* @param \Illuminate\Contracts\Foundation\Application $app
63+
*
6364
* @return void
6465
*/
65-
protected function enableBladeOptimisations()
66+
protected function enableBladeOptimisations(Application $app)
6667
{
67-
$app = $this->app;
68-
69-
// register a new engine
7068
$app['view']->getEngineResolver()->register('blade', function () use ($app) {
7169
$compiler = $app['htmlmin.compiler'];
7270

7371
return new CompilerEngine($compiler);
7472
});
7573

76-
// add the extension
7774
$app->view->addExtension('blade.php', 'blade');
7875
}
7976

8077
/**
8178
* Enable live optimisations.
8279
*
80+
* @param \Illuminate\Contracts\Foundation\Application $app
81+
*
8382
* @return void
8483
*/
85-
protected function enableLiveOptimisations()
84+
protected function enableLiveOptimisations(Application $app)
8685
{
87-
$app = $this->app;
88-
89-
// register a new filter
9086
$app['router']->after(function ($request, $response) use ($app) {
9187
$app['htmlmin']->live($response);
9288
});

0 commit comments

Comments
 (0)