| 1 | <?php namespace Cornford\Googlitics; |
||
| 6 | class AnalyticsServiceProvider extends ServiceProvider { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Indicates if loading of the provider is deferred. |
||
| 10 | * |
||
| 11 | * @var bool |
||
| 12 | */ |
||
| 13 | protected $defer = false; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Bootstrap the application events. |
||
| 17 | * |
||
| 18 | * @return void |
||
| 19 | */ |
||
| 20 | public function boot() |
||
| 21 | { |
||
| 22 | $this->loadViewsFrom(base_path('resources/views/cornford/googlitics'), 'googlitics'); |
||
| 23 | |||
| 24 | $this->publishes( |
||
| 25 | [ |
||
| 26 | __DIR__ . '/../../config/config.php' => config_path('googlitics.php'), |
||
| 27 | __DIR__ . '/../../views' => base_path('resources/views/cornford/googlitics') |
||
| 28 | ], |
||
| 29 | 'googlitics' |
||
| 30 | ); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Register the service provider. |
||
| 35 | * |
||
| 36 | * @return void |
||
| 37 | */ |
||
| 38 | public function register() |
||
| 39 | { |
||
| 40 | $configPath = __DIR__ . '/../../config/config.php'; |
||
| 41 | $this->mergeConfigFrom($configPath, 'googlitics'); |
||
| 42 | |||
| 43 | $this->app['analytics'] = $this->app->share(function($app) |
||
| 44 | { |
||
| 45 | return new Analytics( |
||
| 46 | $this->app->make('Illuminate\Foundation\Application'), |
||
| 47 | $this->app->view, |
||
|
|
|||
| 48 | $app['config']->get('googlitics') |
||
| 49 | ); |
||
| 50 | }); |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Get the services provided by the provider. |
||
| 55 | * |
||
| 56 | * @return array |
||
| 57 | */ |
||
| 58 | public function provides() |
||
| 62 | |||
| 63 | } |
||
| 64 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: