AggregateServiceProvider.php 995B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Illuminate\Support;
  3. class AggregateServiceProvider extends ServiceProvider
  4. {
  5. /**
  6. * The provider class names.
  7. *
  8. * @var array
  9. */
  10. protected $providers = [];
  11. /**
  12. * An array of the service provider instances.
  13. *
  14. * @var array
  15. */
  16. protected $instances = [];
  17. /**
  18. * Register the service provider.
  19. *
  20. * @return void
  21. */
  22. public function register()
  23. {
  24. $this->instances = [];
  25. foreach ($this->providers as $provider) {
  26. $this->instances[] = $this->app->register($provider);
  27. }
  28. }
  29. /**
  30. * Get the services provided by the provider.
  31. *
  32. * @return array
  33. */
  34. public function provides()
  35. {
  36. $provides = [];
  37. foreach ($this->providers as $provider) {
  38. $instance = $this->app->resolveProvider($provider);
  39. $provides = array_merge($provides, $instance->provides());
  40. }
  41. return $provides;
  42. }
  43. }