本文整理汇总了PHP中League\Flysystem\Config::setFallback方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::setFallback方法的具体用法?PHP Config::setFallback怎么用?PHP Config::setFallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\Flysystem\Config
的用法示例。
在下文中一共展示了Config::setFallback方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGet
public function testGet()
{
$config = new Config();
$this->assertFalse($config->has('setting'));
$this->assertNull($config->get('setting'));
$config->set('setting', 'value');
$this->assertEquals('value', $config->get('setting'));
$fallback = new Config(['fallback_setting' => 'fallback_value']);
$config->setFallback($fallback);
$this->assertEquals('fallback_value', $config->get('fallback_setting'));
}
示例2: handle
/**
* Handle.
*
* @param string $path
* @param string $localFilePath
* @param array $config
* @return bool
*/
public function handle($path, $localFilePath, array $config = [])
{
if (!method_exists($this->filesystem, 'getAdapter')) {
return false;
}
if (!method_exists($this->filesystem->getAdapter(), 'putFile')) {
return false;
}
$config = new Config($config);
if (method_exists($this->filesystem, 'getConfig')) {
$config->setFallback($this->filesystem->getConfig());
}
return (bool) $this->filesystem->getAdapter()->putFile($path, $localFilePath, $config);
}
示例3: __construct
/**
* PdoAdapter constructor.
* @param \PDO $db
* @param Config $config
*/
public function __construct(\PDO $db, Config $config = null)
{
$this->db = $db;
if ($config === null) {
$config = new Config();
}
$defaultPrefix = 'flysystem';
$config->setFallback(new Config(['table_prefix' => $defaultPrefix, 'enable_compression' => true, 'chunk_size' => 1048576, 'temp_dir' => sys_get_temp_dir(), 'disable_mysql_buffering' => true]));
$this->config = $config;
$tablePrefix = trim($this->config->get('table_prefix'));
if ($tablePrefix == '') {
$tablePrefix = $defaultPrefix;
}
$this->pathTable = "{$tablePrefix}_path";
$this->chunkTable = "{$tablePrefix}_chunk";
if ($config->get('disable_mysql_buffering')) {
$this->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
}
}
示例4: prepareConfig
/**
* Convert a config array to a Config object with the correct fallback.
*
* @param array $config
*
* @return Config
*/
protected function prepareConfig(array $config)
{
$config = new Config($config);
$config->setFallback($this->config);
return $config;
}
示例5: defaultConfig
protected function defaultConfig()
{
$config = new Config();
$config->setFallback($this->filesystem->getConfig());
return $config;
}