当前位置: 首页>>代码示例>>PHP>>正文


PHP Config::set方法代码示例

本文整理汇总了PHP中League\Flysystem\Config::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::set方法的具体用法?PHP Config::set怎么用?PHP Config::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在League\Flysystem\Config的用法示例。


在下文中一共展示了Config::set方法的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'));
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:11,代码来源:ConfigTests.php

示例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');
 }
开发者ID:patrickrose,项目名称:flysystem-redis,代码行数:22,代码来源:RedisAdapter.php

示例3: upload

 /**
  * Upload an object.
  *
  * @param        $path
  * @param        $body
  * @param Config $config
  *
  * @return array
  */
 protected function upload($path, $body, Config $config)
 {
     $key = $this->applyPathPrefix($path);
     $mimetype = MimeType::detectByFileExtension(pathinfo($path, PATHINFO_EXTENSION));
     $config->set('mimetype', $mimetype);
     $return = parent::upload($path, $body, $config);
     if (function_exists('getimagesizefromstring') && strpos($mimetype, 'image') !== false) {
         if (is_resource($body)) {
             rewind($body);
             $size = getimagesizefromstring(stream_get_contents($body));
         } else {
             $size = getimagesizefromstring($body);
         }
         $this->s3Client->copyObject(['Bucket' => $this->bucket, 'CopySource' => $this->bucket . DS . $key, 'ContentType' => $mimetype, 'Metadata' => ['width' => $size[0], 'height' => $size[1]], 'MetadataDirective' => 'REPLACE', 'Key' => $key]);
     }
     return $return;
 }
开发者ID:uaudio,项目名称:magento-filestorage,代码行数:26,代码来源:AwsS3Adapter.php

示例4: updateStream

 /**
  * {@inheritdoc}
  */
 public function updateStream($path, $resource, Config $config)
 {
     if (!$config->has('visibility') && !$config->has('ACL')) {
         $config->set('ACL', $this->getObjectACL($path));
     }
     return $this->writeStream($path, $resource, $config);
 }
开发者ID:SevenMonks,项目名称:100cities-dev,代码行数:10,代码来源:AwsS3Adapter.php

示例5: configureServer

 /**
  * Configure server files for this store
  *
  * @param bool $forceOverwrite Force regeneration even if files already exist
  * @throws \Exception
  */
 protected function configureServer($forceOverwrite = false)
 {
     // Get server type
     $type = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '*';
     list($type) = explode('/', strtolower($type));
     // Determine configurations to write
     $rules = Config::inst()->get(get_class($this), 'server_configuration', Config::FIRST_SET);
     if (empty($rules[$type])) {
         return;
     }
     $configurations = $rules[$type];
     // Apply each configuration
     $config = new FlysystemConfig();
     $config->set('visibility', 'private');
     foreach ($configurations as $file => $template) {
         if ($forceOverwrite || !$this->has($file)) {
             // Evaluate file
             $content = $this->renderTemplate($template);
             $success = $this->write($file, $content, $config);
             if (!$success) {
                 throw new \Exception("Error writing server configuration file \"{$file}\"");
             }
         }
     }
 }
开发者ID:SpiritLevel,项目名称:silverstripe-framework,代码行数:31,代码来源:AssetAdapter.php


注:本文中的League\Flysystem\Config::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。