for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace League\Flysystem;
class Config
{
/**
* @var array
*/
protected $settings = array();
* @var Config
protected $fallback;
* Constructor.
*
* @param array $settings
public function __construct(array $settings = array())
$this->settings = $settings;
}
* Get a setting.
* @param string $key
* @param mixed $default
* @return mixed config setting or default when not found
public function get($key, $default = null)
if ( ! array_key_exists($key, $this->settings)) {
return $this->getDefault($key, $default);
return $this->settings[$key];
* Check if an item exists by key.
* @return bool
public function has($key)
return array_key_exists($key, $this->settings);
* Try to retrieve a default setting from a config fallback.
protected function getDefault($key, $default)
if ( ! $this->fallback) {
return $default;
return $this->fallback->get($key, $default);
* Set a setting.
* @param mixed $value
* @return $this
public function set($key, $value)
$this->settings[$key] = $value;
return $this;
* Set the fallback.
* @param Config $fallback
public function setFallback(Config $fallback)
$this->fallback = $fallback;