Overtrue\Socialite\Config::get PHP Метод

get() публичный Метод

Get an item from an array using "dot" notation.
public get ( string $key, mixed $default = null ) : mixed
$key string
$default mixed
Результат mixed
    public function get($key, $default = null)
    {
        $config = $this->config;
        if (is_null($key)) {
            return $config;
        }
        if (isset($config[$key])) {
            return $config[$key];
        }
        foreach (explode('.', $key) as $segment) {
            if (!is_array($config) || !array_key_exists($segment, $config)) {
                return $default;
            }
            $config = $config[$segment];
        }
        return $config;
    }

Usage Example

Пример #1
0
 /**
  * Create a new driver instance.
  *
  * @param string $driver
  *
  * @return mixed
  *
  * @throws \InvalidArgumentException
  */
 protected function createDriver($driver)
 {
     if ($provider = $this->initialDrivers[$driver]) {
         $provider = __NAMESPACE__ . '\\Providers\\' . $provider . 'Provider';
         return $this->buildProvider($provider, $this->formatConfig($this->config->get($driver)));
     }
     if (isset($this->customCreators[$driver])) {
         return $this->callCustomCreator($driver);
     }
     throw new InvalidArgumentException("Driver [{$driver}] not supported.");
 }