本文整理汇总了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());
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例8: exchangeArray
public function exchangeArray($Array)
{
foreach ($Array as $Value) {
$this->VerifyValue($Value);
}
parent::exchangeArray($Array);
}
示例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);
}
示例10: exchangeArray
/** {@inheritdoc} */
public function exchangeArray($input)
{
if (isset($input['Id'])) {
// Add Timestamp property
$input['Timestamp'] = new \DateTime("@{$input['Id']}");
}
return parent::exchangeArray($input);
}
示例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);
}
示例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;
}
}
}
示例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);
}
示例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;
}
示例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);
}