Файл: vendor/laravel/framework/src/Illuminate/Support/DefaultProviders.php
Строк: 100
<?php
namespace IlluminateSupport;
class DefaultProviders
{
/**
* The current providers.
*
* @var array
*/
protected $providers;
/**
* Create a new default provider collection.
*
* @return void
*/
public function __construct(?array $providers = null)
{
$this->providers = $providers ?: [
IlluminateAuthAuthServiceProvider::class,
IlluminateBroadcastingBroadcastServiceProvider::class,
IlluminateBusBusServiceProvider::class,
IlluminateCacheCacheServiceProvider::class,
IlluminateFoundationProvidersConsoleSupportServiceProvider::class,
IlluminateCookieCookieServiceProvider::class,
IlluminateDatabaseDatabaseServiceProvider::class,
IlluminateEncryptionEncryptionServiceProvider::class,
IlluminateFilesystemFilesystemServiceProvider::class,
IlluminateFoundationProvidersFoundationServiceProvider::class,
IlluminateHashingHashServiceProvider::class,
IlluminateMailMailServiceProvider::class,
IlluminateNotificationsNotificationServiceProvider::class,
IlluminatePaginationPaginationServiceProvider::class,
IlluminateAuthPasswordsPasswordResetServiceProvider::class,
IlluminatePipelinePipelineServiceProvider::class,
IlluminateQueueQueueServiceProvider::class,
IlluminateRedisRedisServiceProvider::class,
IlluminateSessionSessionServiceProvider::class,
IlluminateTranslationTranslationServiceProvider::class,
IlluminateValidationValidationServiceProvider::class,
IlluminateViewViewServiceProvider::class,
];
}
/**
* Merge the given providers into the provider collection.
*
* @param array $providers
* @return static
*/
public function merge(array $providers)
{
$this->providers = array_merge($this->providers, $providers);
return new static($this->providers);
}
/**
* Replace the given providers with other providers.
*
* @param array $items
* @return static
*/
public function replace(array $replacements)
{
$current = collect($this->providers);
foreach ($replacements as $from => $to) {
$key = $current->search($from);
$current = is_int($key) ? $current->replace([$key => $to]) : $current;
}
return new static($current->values()->toArray());
}
/**
* Disable the given providers.
*
* @param array $providers
* @return static
*/
public function except(array $providers)
{
return new static(collect($this->providers)
->reject(fn ($p) => in_array($p, $providers))
->values()
->toArray());
}
/**
* Convert the provider collection to an array.
*
* @return array
*/
public function toArray()
{
return $this->providers;
}
}