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


PHP ArrayObject::serialize方法代码示例

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


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

示例1: serialize

 public function serialize()
 {
     foreach (new \ArrayIterator($this) as $index => $object) {
         if ($object instanceof DisposableInterface && $object->isDisposed()) {
             $this->offsetUnset($index);
         }
     }
     return parent::serialize();
 }
开发者ID:SystemEd-Jacob,项目名称:nethgui,代码行数:9,代码来源:ArrayDisposable.php

示例2: getComponentData

 public function getComponentData()
 {
     $cachedData = new \ArrayObject(['test_component1' => [ManagerInterface::COMPONENT_ARGUMENTS_KEY => ['argument_name1' => ['value' => 'value1']], ManagerInterface::CHILDREN_KEY => ['custom' => [ManagerInterface::COMPONENT_ARGUMENTS_KEY => ['custom_name1' => ['value' => 'custom_value1']], ManagerInterface::CHILDREN_KEY => []]]]]);
     return [['test_component1', new \ArrayObject(), $cachedData->serialize(), [], ['test_component1' => [ManagerInterface::COMPONENT_ARGUMENTS_KEY => ['argument_name1' => ['argument' => 'value1']], ManagerInterface::CHILDREN_KEY => ['custom' => [ManagerInterface::COMPONENT_ARGUMENTS_KEY => ['custom_name1' => ['argument' => 'custom_value1']], ManagerInterface::CHILDREN_KEY => []]]]]], ['test_component2', new \ArrayObject(['test_component2' => [ManagerInterface::COMPONENT_ARGUMENTS_KEY => ['argument_name2' => ['value' => 'value2']], ManagerInterface::CHILDREN_KEY => ['test_component21' => [ManagerInterface::COMPONENT_ARGUMENTS_KEY => ['argument_name21' => ['value' => 'value21']], ManagerInterface::CHILDREN_KEY => []]]]]), false, ['componentGroup' => [0 => [Converter::DATA_ARGUMENTS_KEY => ['argument_name2' => ['value' => 'value2']], Converter::DATA_ATTRIBUTES_KEY => ['name' => 'attribute_name2'], 'test_component21' => [0 => [Converter::DATA_ARGUMENTS_KEY => ['argument_name21' => ['value' => 'value21']], Converter::DATA_ATTRIBUTES_KEY => ['name' => 'attribute_name21']]]]]], ['test_component2' => [ManagerInterface::COMPONENT_ARGUMENTS_KEY => ['argument_name2' => ['argument' => 'value2']], ManagerInterface::COMPONENT_ATTRIBUTES_KEY => ['name' => 'attribute_name2'], ManagerInterface::CHILDREN_KEY => ['attribute_name21' => [ManagerInterface::COMPONENT_ARGUMENTS_KEY => ['argument_name21' => ['argument' => 'value21']], ManagerInterface::COMPONENT_ATTRIBUTES_KEY => ['name' => 'attribute_name21'], ManagerInterface::CHILDREN_KEY => []]]]]]];
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:5,代码来源:ManagerTest.php

示例3: serialize

 /**
  * overwrites the ArrayObject serialize function so that:
  * - $container->serialize() will serialize only the data collection but not the object instance
  * - serialize($container) will serialize the whole container instance
  *
  * @error 16308
  * @return string
  */
 public function serialize()
 {
     $debug = debug_backtrace();
     if (is_array($debug) && array_key_exists('line', $debug[0])) {
         return serialize($this->getArrayCopy());
     } else {
         $this->rewind();
         return parent::serialize();
     }
 }
开发者ID:xamiro-dev,项目名称:xamiro,代码行数:18,代码来源:Container.php

示例4: serialize

 public function serialize()
 {
     return parent::serialize();
 }
开发者ID:badlamer,项目名称:hhvm,代码行数:4,代码来源:bug45826.php

示例5: serialize

 /**
  * Hack to unset logger instance which cannot be serialized
  *
  * @return string
  */
 public function serialize()
 {
     $logger = $this->_logger;
     unset($this->_logger);
     $result = parent::serialize();
     $this->_logger = $logger;
     return $result;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Menu.php

示例6: serialize

 /**
  * Serializes key values data and root section name
  */
 public function serialize()
 {
     return serialize(array('data' => parent::serialize(), 'name' => $this->_name));
 }
开发者ID:Saltly,项目名称:SourceBans,代码行数:7,代码来源:KeyValues.php

示例7: serialize

 /**
  * Serialization
  * { @internal Don't serialze the connection }}
  * 
  * @return array
  */
 public function serialize()
 {
     if (isset($this->_connection)) {
         $clone = clone $this;
         unset($clone->_connection);
         return $clone->serialize();
     }
     return parent::serialize();
 }
开发者ID:jasny,项目名称:social,代码行数:15,代码来源:Collection.php

示例8: serialize

 /**
  * Serialize an ArrayObject
  * @return void The serialized representation of the <b>ArrayObject</b>.
  */
 public function serialize()
 {
     if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
         return parent::serialize();
     }
     $serialized = serialize($this->getArrayCopy());
     $serialized = 'x:i:0;' . $serialized . ';m:a:0:{}';
     return $serialized;
 }
开发者ID:ehrlichandreas,项目名称:ehrlichandreas1-util,代码行数:13,代码来源:Array.php

示例9: testTraitImpartsSerializableInterface

 /**
  * @covers ::serialize
  * @covers ::unserialize
  * @dataProvider basicDataProvider()
  */
 public function testTraitImpartsSerializableInterface(\ArrayObject $seedArray)
 {
     $serialString = $seedArray->serialize();
     $mock = $this->getArrayObjectDecorator($seedArray);
     $this->assertEquals($serialString, $mock->serialize());
     $mock2 = $this->getArrayObjectDecorator(new \ArrayObject());
     $mock2->unserialize($serialString);
     $this->assertEquals($serialString, $mock2->serialize());
 }
开发者ID:pbull,项目名称:acquia-platform-cloud-data-model,代码行数:14,代码来源:ArrayObjectImplementationMethodsTest.php

示例10: getDirectoryHash

 /**
  * Calculates an hash value for all files with certain extensions.
  * This is used to test if the hash value changed, so if
  * it changed, the appserver can react accordingly.
  *
  * @param \SplFileInfo $directory The directory to watch
  *
  * @return string The hash value build out of the found filenames
  */
 protected function getDirectoryHash(\SplFileInfo $directory)
 {
     // prepare the array
     $files = new \ArrayObject();
     // prepare the array with the file extensions of the files used to build the hash
     $extensionsToWatch = $this->getExtensionsToWatch();
     // clear the cache
     clearstatcache();
     // add all files with the found extensions to the array
     foreach (glob($directory . '/*.{' . implode(',', $extensionsToWatch) . '}', GLOB_BRACE) as $filename) {
         $files->append($filename);
     }
     // calculate and return the hash value for the array
     return md5($files->serialize());
 }
开发者ID:appserver-io,项目名称:appserver,代码行数:24,代码来源:AbstractScanner.php

示例11: ArrayObject

<?php

$dados = ['salmão', 'tilápia', 'sardinha', 'badejo', 'pescada', 'dourado', 'corvina', 'cavala', 'bagre'];
$objarray = new ArrayObject($dados);
$objarray->append('bacalhau');
print 'Posição 2: ' . $objarray->offsetGet(2) . '<br>' . PHP_EOL;
$objarray->offsetSet(2, 'linguado');
print 'Posição 2: ' . $objarray->offsetGet(2) . '<br>' . PHP_EOL;
$objarray->offsetUnset(4);
if ($objarray->offsetExists(10)) {
    echo 'Posição 10 encontrada' . '<br>' . PHP_EOL;
} else {
    echo 'Posição 10 não encontrada' . '<br>' . PHP_EOL;
}
print 'Total: ' . $objarray->count();
$objarray[] = 'atum';
$objarray->natsort();
print '<br>' . PHP_EOL;
foreach ($objarray as $item) {
    print 'Item: ' . $item . '<br>' . PHP_EOL;
}
print $objarray->serialize();
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:22,代码来源:spl_array.php

示例12: getDirectoryHash

 /**
  * Calculates an hash value for all files with certain extensions.
  * This is used to test if the hash value changed, so if
  * it changed, the appserver can react accordingly.
  *
  * @param \SplFileInfo $directory         The directory to watch
  * @param array        $extensionsToWatch The extensions we have to look for
  *
  * @return string The hash value build out of the found filenames
  */
 protected function getDirectoryHash(\SplFileInfo $directory, array $extensionsToWatch)
 {
     // prepare the array
     $files = new \ArrayObject();
     // add all files with the found extensions to the array
     foreach (new \DirectoryIterator($directory) as $fileInfo) {
         if ($fileInfo->isFile() && in_array($fileInfo->getExtension(), $extensionsToWatch)) {
             $files->append($fileInfo->getFilename());
         }
     }
     // calculate and return the hash value for the array
     return md5($files->serialize());
 }
开发者ID:n3rds-eddie,项目名称:TechDivision_ApplicationServer,代码行数:23,代码来源:AbstractScanner.php

示例13: ArrayObject

<?php

$a = new ArrayObject(array(1, 2, 3));
$b = $a->serialize();
$c = new ArrayObject();
$d = $c->unserialize($b);
var_dump($a);
var_dump($c);
var_dump($d);
var_dump($a == $c);
开发者ID:badlamer,项目名称:hhvm,代码行数:10,代码来源:unserialize.php

示例14: serialize

 /**
  * Implementation of ArrayAccess::serialize()
  *
  * Returns a serialized ArrayObject.
  *
  * @return string The serialized representation of the ArrayObject.
  */
 public function serialize()
 {
     return $this->arrayObject->serialize();
 }
开发者ID:pbull,项目名称:acquia-platform-cloud-data-model,代码行数:11,代码来源:ArrayObjectImplementationMethods.php


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