當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。