Вход Регистрация
Файл: vendor/laravel/framework/src/Illuminate/Support/DefaultProviders.php
Строк: 117
<?php

namespace IlluminateSupport;

class 
DefaultProviders
{
    
/**
     * The current providers.
     *
     * @var array<class-string>
     */
    
protected $providers;

    
/**
     * Create a new default provider collection.
     *
     * @param  array<class-string>|null  $providers
     */
    
public function __construct(?array $providers null)
    {
        
$this->providers $providers ?: [
            
IlluminateAuthAuthServiceProvider::class,
            
IlluminateBroadcastingBroadcastServiceProvider::class,
            
IlluminateBusBusServiceProvider::class,
            
IlluminateCacheCacheServiceProvider::class,
            
IlluminateFoundationProvidersConsoleSupportServiceProvider::class,
            
IlluminateConcurrencyConcurrencyServiceProvider::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<class-string>  $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<class-string, class-string>  $replacements
     * @return static
     */
    
public function replace(array $replacements)
    {
        
$current = new Collection($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<class-string>  $providers
     * @return static
     */
    
public function except(array $providers)
    {
        return new static((new 
Collection($this->providers))
            ->
reject(fn ($p) => in_array($p$providers))
            ->
values()
            ->
toArray());
    }

    
/**
     * Convert the provider collection to an array.
     *
     * @return array<class-string>
     */
    
public function toArray()
    {
        return 
$this->providers;
    }
}
Онлайн: 0
Реклама