本文整理汇总了PHP中League\Flysystem\Config::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::has方法的具体用法?PHP Config::has怎么用?PHP Config::has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\Flysystem\Config
的用法示例。
在下文中一共展示了Config::has方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptionsFromConfig
/**
* Returns an array of options from the config.
*
* @param Config $config
* @return array
*/
protected function getOptionsFromConfig(Config $config)
{
$options = [];
if ($config->has('visibility')) {
$options['acl'] = $config->get('visibility') === AdapterInterface::VISIBILITY_PUBLIC ? 'publicRead' : 'private';
}
if ($config->has('mimetype')) {
$options['mimetype'] = $config->get('mimetype');
}
// TODO: consider other metadata which we can set here
return $options;
}
示例2: write
/**
* Write a new file.
*
* @param string $path
* @param string $contents
* @param Config $config Config object
*
* @return array|false false on failure file meta data on success
*/
public function write($path, $contents, Config $config)
{
if ($config->has('ttl') && !$config->has('expirationType')) {
$config->set('expirationType', self::EXPIRE_IN_SECONDS);
}
$args = array_merge([$path, $contents], array_filter([$config->get('expirationType'), $config->get('ttl'), $config->get('setFlag')], function ($value) {
return !is_null($value);
}));
if (!call_user_func_array([$this->client, 'set'], $args)) {
return false;
}
return compact('path', 'contents');
}
示例3: write
/**
* {@inheritdoc}
*/
public function write($path, $contents, Config $config)
{
$location = $this->applyPathPrefix($path);
$headers = [];
if ($config && $config->has('headers')) {
$headers = $config->get('headers');
}
$response = $this->container->uploadObject($location, $contents, $headers);
return $this->normalizeObject($response);
}
示例4: 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'));
}
示例5: getOptionsFromConfig
/**
* Get options from the config.
*
* @param Config $config
*
* @return array
*/
protected function getOptionsFromConfig(Config $config)
{
$options = $this->options;
if ($visibility = $config->get('visibility')) {
// For local reference
$options['visibility'] = $visibility;
// For external reference
$options['ACL'] = $visibility === AdapterInterface::VISIBILITY_PUBLIC ? 'public-read' : 'private';
}
if ($mimetype = $config->get('mimetype')) {
// For local reference
$options['mimetype'] = $mimetype;
// For external reference
$options['ContentType'] = $mimetype;
}
foreach (static::$metaOptions as $option) {
if (!$config->has($option)) {
continue;
}
$options[$option] = $config->get($option);
}
return $options;
}
示例6: getOptionsFromConfig
/**
* Get options from the config.
*
* @param Config $config
* @return array
*/
protected function getOptionsFromConfig(Config $config)
{
$options = $this->options;
foreach (static::$mappingOptions as $option => $ossOption) {
if (!$config->has($option)) {
continue;
}
$options[$ossOption] = $config->get($option);
}
return $options;
}
示例7: getOptionsFromConfig
/**
* Retrieve options from a Config instance.
*
* @param Config $config
*
* @return array
*/
protected function getOptionsFromConfig(Config $config)
{
$options = [];
foreach (static::$metaOptions as $option) {
if (!$config->has($option)) {
continue;
}
$options[$option] = $config->get($option);
}
if ($mimetype = $config->get('mimetype')) {
// For local reference
$options['mimetype'] = $mimetype;
// For external reference
$options['ContentType'] = $mimetype;
}
return $options;
}
示例8: getOptionsFromConfig
/**
* Retrieve options from a Config instance.
*
* @param Config $config
*
* @return CreateBlobOptions
*/
protected function getOptionsFromConfig(Config $config)
{
$options = new CreateBlobOptions();
foreach (static::$metaOptions as $option) {
if (!$config->has($option)) {
continue;
}
call_user_func([$options, "set{$option}"], $config->get($option));
}
if ($mimetype = $config->get('mimetype')) {
$options->setContentType($mimetype);
}
return $options;
}