for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Displore\Widgets;
use Illuminate\Support\ServiceProvider;
class WidgetsServiceProvider extends ServiceProvider
{
/**
* Perform post-registration booting of services.
*/
public function boot()
$this->publishes([
__DIR__.'/../config/widgets.php' => config_path('displore/widgets.php'),
], 'displore.widgets.config');
$this->mergeConfigFrom(__DIR__.'/../config/widgets.php', 'displore.widgets');
}
* Register any package services.
public function register()
if (config('displore.widgets.dynamic')) {
$this->registerDynamicProvider();
} else {
$this->registerProvider();
* Register default service.
public function registerProvider()
$this->app->singleton('widget', function () {
return new WidgetsProvider(config('displore.widgets.providers'));
});
* Register dynamic resolving service.
public function registerDynamicProvider()
return (new DynamicWidgetsProvider())
->withPath(config('displore.widgets.path'))
->withNamespace(config('displore.widgets.namespace'))
->scanForProviders();
* Get the services provided by the provider.
*
* @return array
string[]
This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.
array
public function provides()
return ['widget'];
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.