PHP 8.3.31
Preview: Manager.php Size: 4.42 KB
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Support/Manager.php

<?php

namespace Illuminate\Support;

use Closure;
use Illuminate\Contracts\Container\Container;
use InvalidArgumentException;

abstract class Manager
{
    /**
     * The container instance.
     *
     * @var \Illuminate\Contracts\Container\Container
     */
    protected $container;

    /**
     * The configuration repository instance.
     *
     * @var \Illuminate\Contracts\Config\Repository
     */
    protected $config;

    /**
     * The registered custom driver creators.
     *
     * @var array
     */
    protected $customCreators = [];

    /**
     * The array of created "drivers".
     *
     * @var array
     */
    protected $drivers = [];

    /**
     * Create a new manager instance.
     *
     * @param  \Illuminate\Contracts\Container\Container  $container
     * @return void
     */
    public function __construct(Container $container)
    {
        $this->container = $container;
        $this->config = $container->make('config');
    }

    /**
     * Get the default driver name.
     *
     * @return string
     */
    abstract public function getDefaultDriver();

    /**
     * Get a driver instance.
     *
     * @param  string|null  $driver
     * @return mixed
     *
     * @throws \InvalidArgumentException
     */
    public function driver($driver = null)
    {
        $driver = $driver ?: $this->getDefaultDriver();

        if (is_null($driver)) {
            throw new InvalidArgumentException(sprintf(
                'Unable to resolve NULL driver for [%s].', static::class
            ));
        }

        // If the given driver has not been created before, we will create the instances
        // here and cache it so we can return it next time very quickly. If there is
        // already a driver created by this name, we'll just return that instance.
        if (! isset($this->drivers[$driver])) {
            $this->drivers[$driver] = $this->createDriver($driver);
        }

        return $this->drivers[$driver];
    }

    /**
     * Create a new driver instance.
     *
     * @param  string  $driver
     * @return mixed
     *
     * @throws \InvalidArgumentException
     */
    protected function createDriver($driver)
    {
        // First, we will determine if a custom driver creator exists for the given driver and
        // if it does not we will check for a creator method for the driver. Custom creator
        // callbacks allow developers to build their own "drivers" easily using Closures.
        if (isset($this->customCreators[$driver])) {
            return $this->callCustomCreator($driver);
        }

        $method = 'create'.Str::studly($driver).'Driver';

        if (method_exists($this, $method)) {
            return $this->$method();
        }

        throw new InvalidArgumentException("Driver [$driver] not supported.");
    }

    /**
     * Call a custom driver creator.
     *
     * @param  string  $driver
     * @return mixed
     */
    protected function callCustomCreator($driver)
    {
        return $this->customCreators[$driver]($this->container);
    }

    /**
     * Register a custom driver creator Closure.
     *
     * @param  string  $driver
     * @param  \Closure  $callback
     * @return $this
     */
    public function extend($driver, Closure $callback)
    {
        $this->customCreators[$driver] = $callback;

        return $this;
    }

    /**
     * Get all of the created "drivers".
     *
     * @return array
     */
    public function getDrivers()
    {
        return $this->drivers;
    }

    /**
     * Get the container instance used by the manager.
     *
     * @return \Illuminate\Contracts\Container\Container
     */
    public function getContainer()
    {
        return $this->container;
    }

    /**
     * Set the container instance used by the manager.
     *
     * @param  \Illuminate\Contracts\Container\Container  $container
     * @return $this
     */
    public function setContainer(Container $container)
    {
        $this->container = $container;

        return $this;
    }

    /**
     * Forget all of the resolved driver instances.
     *
     * @return $this
     */
    public function forgetDrivers()
    {
        $this->drivers = [];

        return $this;
    }

    /**
     * Dynamically call the default driver instance.
     *
     * @param  string  $method
     * @param  array  $parameters
     * @return mixed
     */
    public function __call($method, $parameters)
    {
        return $this->driver()->$method(...$parameters);
    }
}

Directory Contents

Dirs: 6 × Files: 38

Name Size Perms Modified Actions
Defer DIR
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
Facades DIR
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
Process DIR
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
Testing DIR
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
Traits DIR
- drwxrwxrwx 2025-09-17 06:53:02
Edit Download
995 B lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.94 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
898 B lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.98 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
6.79 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
4.25 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
7.76 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
3.15 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
2.96 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
6.27 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.34 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
12.93 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
665 B lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.07 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
2.09 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
3.47 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.05 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
5.87 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
4.42 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
10.03 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
5.16 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
3.35 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
10.60 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.88 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
2.05 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
2.64 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
2.84 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
2.00 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
4.50 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
14.67 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
11.78 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
57.38 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
34.67 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.66 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
9.68 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
1.95 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
4.55 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download
2.59 KB lrw-rw-rw- 2025-09-17 06:53:01
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).