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


PHP ArrayObject::exchangeArray方法代码示例

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


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

示例1: clear

 /**
  * Clear datas with $uid key
  * @param mixed $uid
  * @return void
  */
 public function clear($uid = null)
 {
     $this->alloc();
     if ($uid) {
         return $this->session->offsetUnset($uid);
     }
     return $this->session->exchangeArray(array());
 }
开发者ID:cityware,项目名称:city-shared-memory,代码行数:13,代码来源:Session.php

示例2: appendCollection

 public function appendCollection(\Traversable $collection)
 {
     $buff = [];
     foreach ($this->collection as $i) {
         $buff[] = $i;
     }
     foreach ($collection as $i) {
         $buff[] = $i;
     }
     $this->collection->exchangeArray($buff);
 }
开发者ID:dreamcommerce,项目名称:appstore-bundle,代码行数:11,代码来源:CollectionWrapper.php

示例3: testArrayObjectUsage

 public function testArrayObjectUsage()
 {
     $data = array('prop' => 'value');
     $this->collection->exchangeArray(array((object) $data));
     $this->assertCount(1, $this->collection);
     $this->assertEquals((object) $data, $this->collection[0]);
     $this->collection[] = (object) $data;
     $this->assertCount(2, $this->collection);
     $this->assertEquals((object) $data, $this->collection[1]);
     foreach ($this->collection as $component) {
         $this->assertEquals((object) $data, $component);
     }
 }
开发者ID:rickwong,项目名称:phur,代码行数:13,代码来源:CollectionTest.php

示例4: compile

 public function compile($name)
 {
     $source = $this->getLoader()->getSource($name);
     $cacheKey = $this->getCacheFilename($name);
     $phpStr = '';
     try {
         $this->partials->exchangeArray([new FileResource($this->getLoader()->getCacheKey($name))]);
         $phpStr = LightnCandy::compile($source, $this->options);
     } catch (\Exception $e) {
         throw new LoaderException($e->getMessage());
     }
     $this->cache->write($cacheKey, '<?php // ' . $name . PHP_EOL . $phpStr, $this->partials->getArrayCopy());
     return $phpStr;
 }
开发者ID:jayS-de,项目名称:HandlebarsBundle,代码行数:14,代码来源:HandlebarsEnvironment.php

示例5: languageAndWorkspaceOverlay

 /**
  * Do translation and workspace overlay
  *
  * @param \ArrayObject $data
  * @return void
  */
 public function languageAndWorkspaceOverlay(\ArrayObject $data)
 {
     $overlayedMetaData = $this->getTsfe()->sys_page->getRecordOverlay('sys_file_metadata', $data->getArrayCopy(), $this->getTsfe()->sys_language_content, $this->getTsfe()->sys_language_contentOL);
     if ($overlayedMetaData !== NULL) {
         $data->exchangeArray($overlayedMetaData);
     }
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:13,代码来源:FileMetadataOverlayAspect.php

示例6: ld

 /**
  * Loads settings
  * @param $force
  * @return unknown_type
  */
 function ld($force = false)
 {
     if ($this->loaded && !$force) {
         return;
     }
     global $DB;
     $where = array('`setset`.`property` = `settings`.`property`', 'settings.id' => $this->ID);
     if ($this->ID > 0) {
         global $Controller;
         $myself = $Controller->{(string) $this->ID}(OVERRIDE);
         if (is_a($myself, 'Group')) {
             $where['setset.visible'] = array(3, 4, 5, 6);
         } elseif (is_a($myself, 'User')) {
             $where['setset.visible'] = array(1, 2, 3, 4);
         } else {
             return false;
         }
     }
     $load = $DB->{'setset,settings'}->asArray($where, 'settings.property,settings.value,setset.type', false, true);
     if (!is_array($load)) {
         $load = array();
     }
     $this->_TYPE = array();
     $new_data = array();
     foreach ($load as $property => $data) {
         $new_data[$property] = $data['value'];
         $this->_TYPE[$property] = $data['type'];
     }
     parent::exchangeArray($new_data);
     $this->loaded = true;
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:36,代码来源:Settings.php

示例7: set

 public function set($value)
 {
     if (!(is_array($value) || empty($value))) {
         throw new \InvalidArgumentException(sprintf('%s: Invalid data type. Expected `array` or `EMPTY`, was `%s`', get_class($this), gettype($value)), 1322148826);
     }
     if (is_null($this->modified)) {
         $this->lazyInitialization();
     }
     // handle set-NULL
     if ($value === NULL) {
         if ($this->data === NULL) {
             // nothing to do
         } else {
             $this->modified = TRUE;
             $this->data = NULL;
         }
         return;
     }
     // empty string translated to empty array
     if ($value === '') {
         $value = array();
     }
     if (is_null($this->data)) {
         $this->data = new \ArrayObject($value);
         $this->modified = TRUE;
     } elseif ($this->data->getArrayCopy() !== $value) {
         $this->data->exchangeArray($value);
         $this->modified = TRUE;
     }
 }
开发者ID:SystemEd-Jacob,项目名称:nethgui,代码行数:30,代码来源:ArrayAdapter.php

示例8: exchangeArray

 public function exchangeArray($Array)
 {
     foreach ($Array as $Value) {
         $this->VerifyValue($Value);
     }
     parent::exchangeArray($Array);
 }
开发者ID:timetoogo,项目名称:php-generics,代码行数:7,代码来源:ArrayOf.generic.php

示例9: exchangeArray

 public function exchangeArray($Input)
 {
     $this->IsAltered = true;
     $this->RemovedEntities = array_merge($this->RemovedEntities, $this->getArrayCopy());
     $this->AddedEntities = array_merge($this->AddedEntities, $Input);
     parent::exchangeArray($Input);
 }
开发者ID:timetoogo,项目名称:penumbra,代码行数:7,代码来源:Collection.php

示例10: exchangeArray

 /** {@inheritdoc} */
 public function exchangeArray($input)
 {
     if (isset($input['Id'])) {
         // Add Timestamp property
         $input['Timestamp'] = new \DateTime("@{$input['Id']}");
     }
     return parent::exchangeArray($input);
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:9,代码来源:Package.php

示例11: exchangeArray

 /**
  * @param mixed $input
  * @return array the old array
  */
 public function exchangeArray($input)
 {
     foreach ($input as $value) {
         if (!is_a($value, $this->allowedClass)) {
             $this->throwInvalid($value);
         }
     }
     return parent::exchangeArray($input);
 }
开发者ID:kaliop-uk,项目名称:ezmigrationbundle,代码行数:13,代码来源:AbstractCollection.php

示例12: exchangeArray

 /**
  * @param mixed $data
  * @return void
  */
 public function exchangeArray($data)
 {
     parent::exchangeArray($data);
     if ($data && is_array($data)) {
         foreach ($data as $key => $value) {
             $this->{$key} = $value;
         }
     }
 }
开发者ID:sumiyoshi,项目名称:BokunoZF2,代码行数:13,代码来源:AbstractModel.php

示例13: exchangeArray

 /**
  * @param Image[] $input
  * @throws \InvalidArgumentException
  * @return Image[]|void
  */
 public function exchangeArray($input)
 {
     foreach ($input as $idx => $value) {
         if (false === $value instanceof Image) {
             throw new \InvalidArgumentException("Value[{$idx}] is not an instance of Image");
         }
         $value->setCollection($this);
     }
     return parent::exchangeArray($input);
 }
开发者ID:mlebkowski,项目名称:crane,代码行数:15,代码来源:ImageCollection.php

示例14: setSession

 public function setSession(\Nethgui\Utility\SessionInterface $session)
 {
     /* @var $data \ArrayObject */
     $data = $session->retrieve(__CLASS__);
     if ($data !== NULL) {
         /* @var $data \ArrayObject */
         $this->data->exchangeArray(array_replace_recursive($data->getArrayCopy(), $this->data->getArrayCopy()));
     }
     $session->store(__CLASS__, $this->data);
     return $this;
 }
开发者ID:SystemEd-Jacob,项目名称:nethgui,代码行数:11,代码来源:SessionDatabase.php

示例15: exchangeArray

 /**
  * See SPL class ArrayObject.
  * Performs additional value checks on the array.
  * 
  * @param array(ezcPersistentRelation) $array New relations array.
  * @return void
  */
 public function exchangeArray($array)
 {
     foreach ($array as $offset => $value) {
         if (!$value instanceof ezcPersistentRelation && !$value instanceof ezcPersistentRelationCollection) {
             throw new ezcBaseValueException('value', $value, 'ezcPersistentRelation or ezcPersistentRelationCollection');
         }
         if (!is_string($offset) || strlen($offset) < 1) {
             throw new ezcBaseValueException('offset', $offset, 'string, length > 0');
         }
     }
     parent::exchangeArray($array);
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:19,代码来源:persistent_object_relations.php


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