本文整理汇总了PHP中ArrayObject::setFlags方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayObject::setFlags方法的具体用法?PHP ArrayObject::setFlags怎么用?PHP ArrayObject::setFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayObject
的用法示例。
在下文中一共展示了ArrayObject::setFlags方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: castArrayObject
public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, $isNested)
{
$class = $stub->class;
$flags = $c->getFlags();
$b = array("~flag::STD_PROP_LIST" => (bool) ($flags & \ArrayObject::STD_PROP_LIST), "~flag::ARRAY_AS_PROPS" => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS), "~iteratorClass" => $c->getIteratorClass(), "~storage" => $c->getArrayCopy());
if ($class === 'ArrayObject') {
$a = $b;
} else {
if (!($flags & \ArrayObject::STD_PROP_LIST)) {
$c->setFlags(\ArrayObject::STD_PROP_LIST);
if ($a = (array) $c) {
$class = new \ReflectionClass($class);
foreach ($a as $k => $p) {
if (!isset($k[0]) || "" !== $k[0] && !$class->hasProperty($k)) {
unset($a[$k]);
$a["+" . $k] = $p;
}
}
}
$c->setFlags($flags);
}
$a += $b;
}
return $a;
}
示例2: __construct
/**
* Constructor method
*
* @param ORM $orm
* @param int $idChat = null
* @access public
* @return void
*/
public function __construct(ORM $orm, $idChat = null)
{
$this->orm = $orm;
$this->idChat = $idChat;
$this->talkingTo = new ArrayObject();
$this->talkingTo->setFlags(ArrayObject::ARRAY_AS_PROPS);
$this->parseInformation();
}
示例3: get_array_object
/**
* change array to array object
* @param array $_array : target array
* @return boolean|ArrayObject
*/
function get_array_object($_array)
{
if (!is_array($_array)) {
return false;
}
$obj = new ArrayObject($_array);
$obj->setFlags(ArrayObject::ARRAY_AS_PROPS);
return $obj;
}
示例4: parseSpellJSON
/**
* UNUSED
* @param $json - Riot-API-JSON
* @param array $retArr - If the array shall already contain some default values, specify one here.
* @param bool $onlySprites - Unused
* @return ArrayObject
*/
function parseSpellJSON($json, $onlySprites = false)
{
$retArr = array();
$arr = json_decode($json, true);
foreach ($arr["data"] as $value) {
if ($onlySprites) {
$retArr[$value["key"]] = "http://ddragon.leagueoflegends.com/cdn/5.16.1/img/spell/" . $value["key"] . ".png";
continue;
}
$retArr[$value["key"]] = new ArrayObject(array("img" => "http://ddragon.leagueoflegends.com/cdn/5.16.1/img/spell/" . $value["key"] . ".png", "name" => $value["name"], "key" => $value["key"]), ArrayObject::ARRAY_AS_PROPS);
}
$retObj = new ArrayObject($retArr);
$retObj->setFlags(ArrayObject::ARRAY_AS_PROPS);
return $retObj;
}
示例5: castArrayObject
public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$class = $stub->class;
$flags = $c->getFlags();
$b = array($prefix . 'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST), $prefix . 'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS), $prefix . 'iteratorClass' => $c->getIteratorClass(), $prefix . 'storage' => $c->getArrayCopy());
if ($class === 'ArrayObject') {
$a = $b;
} else {
if (!($flags & \ArrayObject::STD_PROP_LIST)) {
$c->setFlags(\ArrayObject::STD_PROP_LIST);
$a = Caster::castObject($c, new \ReflectionClass($class));
$c->setFlags($flags);
}
$a += $b;
}
return $a;
}
示例6: setFlags
function setFlags($flags)
{
echo __METHOD__ . "({$flags})\n";
ArrayObject::setFlags($flags);
}
示例7: ArrayObject
<?php
$a = new ArrayObject();
$a['hello'] = 'Moto';
$a['attr'] = (object) array('name' => 'Vadim', 'surname' => 'Voituk');
var_dump($a->offsetExists('attr'));
$a->setFlags(ArrayObject::ARRAY_AS_PROPS);
var_dump($a->attr);
示例8: array
<?php
// Array of available fruits
$fruits = array("lemons" => 1, "oranges" => 4, "bananas" => 5, "apples" => 10);
$fruitsArrayObject = new ArrayObject($fruits);
// Get the current flags
$flags = $fruitsArrayObject->getFlags();
var_dump($flags);
// Set new flags
$fruitsArrayObject->setFlags(ArrayObject::ARRAY_AS_PROPS);
// Get the new flags
$flags = $fruitsArrayObject->getFlags();
var_dump($flags);
示例9: array
<?php
#Example #1 ArrayIterator::Get the current flags
$array = array('one' => 'one lakh', 'two' => 'two crores', 'three' => 'three thousand', 'Four Rupees', 'eighT' => 'Eight millions');
#print_r($array);
$arrayobject = new ArrayObject($array);
$arrayobject->setFlags(ArrayIterator::ARRAY_AS_PROPS);
var_dump($arrayobject);
echo $arrayobject->one;
#echo $arrayobject->one;
?>
示例10: setFlags
/**
* Implementation of ArrayObject::setFlags().
*
* Set the flags that change the behavior of the ArrayObject.
*
* No value is returned.
*
* @param int $flags
*/
public function setFlags($flags)
{
$this->arrayObject->setFlags($flags);
}
示例11: addRegistryContainer
/**
* Adds an extra source container to this object.
*
* @param mixed $container \Zend_Config, array or \ArrayObject
* @param string $name An optional name to identify the container
* @return \MUtil_Registry_Source
*/
public function addRegistryContainer($container, $name = null)
{
if ($container instanceof \Zend_Config) {
$container = $container->toArray();
}
if (is_array($container)) {
$container = new \ArrayObject($container);
}
if ($container instanceof \ArrayObject) {
$container->setFlags(\ArrayObject::ARRAY_AS_PROPS);
}
// Always append in reverse order
if (null === $name) {
array_unshift($this->_containers, $container);
} else {
$this->_containers = array($name => $container) + $this->_containers;
}
return $this;
}