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


PHP Collection::set方法代码示例

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


在下文中一共展示了Collection::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test1_Queries

 public function test1_Queries()
 {
     $this->assertEquals(TRUE, static::$collection->any());
     $this->assertEquals('stuff', static::$collection->{'part1.item1'});
     static::$collection['set'] = ['test' => 'set test'];
     $this->assertEquals(static::$collection->get('set'), ['test' => 'set test']);
     $this->assertEquals(NULL, static::$collection->set(999, 'set test'));
     $this->assertEquals('default', static::$collection->search_and_replace('does-not-exist', 'default'));
     $this->assertEquals(['test' => 'set test'], static::$collection->search_and_replace('set', 'default'));
     $this->assertEquals(static::$collection->search_and_replace('set.test'), 'set test');
     static::$collection->forget('set');
     $this->assertTrue(!static::$collection->has('set'));
 }
开发者ID:anctemarry27,项目名称:cogs,代码行数:13,代码来源:CollectionTest.php

示例2: set

 /**
  * Set HTTP header value
  *
  * This method sets a header value. It replaces
  * any values that may already exist for the header name.
  *
  * @param string $key   The case-insensitive header name
  * @param string $value The header value
  */
 public function set($key, $value)
 {
     if (!is_array($value)) {
         $value = [$value];
     }
     parent::set($this->normalizeKey($key), ['value' => $value, 'originalKey' => $key]);
 }
开发者ID:slimphp,项目名称:Slim-Http,代码行数:16,代码来源:Headers.php

示例3: set

 /**
  * @access public
  * @param [type] $id   [description]
  * @param [type] $item [description]
  */
 public function set($id, $item)
 {
     if ($id === 'slim.flash') {
         return;
     }
     $id = str_replace('.', '_', $id);
     $_SESSION[$id] = $item;
     parent::set($id, $item);
 }
开发者ID:pedrokoblitz,项目名称:maltz,代码行数:14,代码来源:Session.php

示例4: set

 /**
  * /
  * @param [type] $id     [description]
  * @param array  $cookie [description]
  */
 public function set($id, array $cookie)
 {
     if (!is_string($id)) {
         throw new \Exception("Cookie index must be string", 01);
     }
     $newId = str_replace('.', '_', $id);
     setcookie($newId, $cookie['value'], isset($cookie['expires']) ? $cookie['expires'] : null, isset($cookie['path']) ? $cookie['path'] : null, isset($cookie['domain']) ? $cookie['domain'] : null, isset($cookie['secure']) ? $cookie['secure'] : null, isset($cookie['httponly']) ? $cookie['httponly'] : null);
     parent::set($id, $cookie);
 }
开发者ID:pedrokoblitz,项目名称:maltz,代码行数:14,代码来源:CookieJar.php

示例5: addImageSize

 /**
  * Set (add) image size
  *
  * @param ImageSize $size
  * @return boolean
  */
 public function addImageSize(ImageSize $size)
 {
     if ($this->imageSizes->containsKey($size->getName())) {
         return false;
     } else {
         $this->imageSizes->set($size->getName(), $size);
         return true;
     }
 }
开发者ID:sitesupra,项目名称:sitesupra,代码行数:15,代码来源:Image.php

示例6: parseQueryString

 /**
  * Parses query string into a collection of parameters.
  *
  * @todo Think about better way of doing this
  *
  * @param string $queryString Query string to parse.
  *
  * @return \Students\Utility\Collection Collection of parsed data.
  */
 public static function parseQueryString($queryString)
 {
     // Array with the results.
     $result = new Collection([]);
     // Explode the query string by '&' symbol.
     $keyValue = !empty($queryString) ? explode('&', $queryString) : [];
     foreach ($keyValue as $key => $value) {
         $param = explode('=', $value);
         $result->set($param[0], $param[1]);
     }
     return $result;
 }
开发者ID:foobar1643,项目名称:student-list,代码行数:21,代码来源:StringUtils.php

示例7: set

 /**
  * {@inheritdoc}
  */
 public function set($key, $value)
 {
     $this->coll->set($key, $value);
     $this->changed();
 }
开发者ID:richardmiller,项目名称:mongodb-odm,代码行数:8,代码来源:PersistentCollection.php

示例8: languages

 public function languages()
 {
     $languages = new Collection();
     $root = $this->roots()->languages();
     foreach (dir::read($root) as $file) {
         // skip invalid language files
         if (f::extension($file) != 'php') {
             continue;
         }
         // fetch all strings from the language file
         $strings = (require $root . DS . $file);
         // skip invalid language files
         if (!is_array($strings)) {
             continue;
         }
         // create the language object
         $language = new Obj($strings);
         $language->code = str_replace('.php', '', $file);
         $languages->set($language->code, $language);
     }
     return $languages;
 }
开发者ID:v1m0,项目名称:kirby-f6,代码行数:22,代码来源:panel.php

示例9: save

 /**
  * Helper function to create or update a Collection from the supplied data.
  *
  * @param array $data
  * @return collection           The newly created/updated collection
  */
 public static function save($data)
 {
     if (array_key_exists('id', $data)) {
         $id = $data['id'];
     } else {
         $id = 0;
     }
     $collection = new Collection($id, $data);
     $collection->set('mtime', time());
     $collection->commit();
     return $collection;
     // return newly created Collections id
 }
开发者ID:agwells,项目名称:Mahara-1,代码行数:19,代码来源:collection.php

示例10: addPerimeter

 /**
  * @param PerimeterInterface $perimeter
  */
 public function addPerimeter(PerimeterInterface $perimeter)
 {
     $this->perimeters->set($perimeter->getType(), $perimeter);
 }
开发者ID:open-orchestra,项目名称:open-orchestra-cms-bundle,代码行数:7,代码来源:Group.php

示例11: set

 /**
  * {@inheritdoc}
  */
 public function set($key, $value)
 {
     $this->_initialize();
     $this->_coll->set($key, $value);
     $this->_changed();
 }
开发者ID:andreia,项目名称:doctrine,代码行数:9,代码来源:PersistentCollection.php

示例12: set

 function set($key, $value)
 {
     Assert::isTrue($value instanceof $this->type, 'wrong type passed to %s, expected %s but %s found', get_class($this), $this->type, gettype($value));
     parent::set($key, $value);
     return $this;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:6,代码来源:TypedCollection.class.php

示例13: set

 /**
  * {@inheritdoc}
  */
 public function set($key, $value) : parent
 {
     if (isset($this->elements[$key])) {
         $this->removeFromHistory($this->elements[$key]);
     }
     $this->added[] = $value;
     return parent::set($key, $value);
 }
开发者ID:cawaphp,项目名称:cawa,代码行数:11,代码来源:CollectionModel.php

示例14: set

 /**
  * Headers are allowed to have multiple values, so we must add support for that
  *
  * @inheritdoc
  * @param string|array $values The value or values
  * @param bool $shouldReplace Whether or not to replace the value
  */
 public function set($name, $values, $shouldReplace = true)
 {
     $name = $this->normalizeName($name);
     $values = (array) $values;
     if ($shouldReplace || !$this->has($name)) {
         parent::set($name, $values);
     } else {
         parent::set($name, array_merge($this->values[$name], $values));
     }
 }
开发者ID:scaleddynamics,项目名称:Opulence,代码行数:17,代码来源:Headers.php

示例15: languages

 public function languages()
 {
     $languages = new Collection();
     $root = $this->roots()->languages();
     foreach (dir::read($root) as $file) {
         $language = new Obj(require $root . DS . $file);
         $language->code = str_replace('.php', '', $file);
         $languages->set($language->code, $language);
     }
     return $languages;
 }
开发者ID:DerZyklop,项目名称:gutesache.pxwrk.de,代码行数:11,代码来源:panel.php


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