本文整理汇总了PHP中ArrayObject::getFlags方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayObject::getFlags方法的具体用法?PHP ArrayObject::getFlags怎么用?PHP ArrayObject::getFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayObject
的用法示例。
在下文中一共展示了ArrayObject::getFlags方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: ArrayObject
<?php
$ao = new ArrayObject(new ArrayObject(new stdClass()));
var_dump($ao->getFlags());
$ao = new ArrayObject(new ArrayObject(array(1, 2, 3)), ArrayObject::STD_PROP_LIST);
var_dump($ao->getFlags());
$ao = new ArrayObject(new ArrayIterator(new ArrayObject()), ArrayObject::ARRAY_AS_PROPS);
var_dump($ao->getFlags());
$ao = new ArrayObject(new ArrayObject(), ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
var_dump($ao->getFlags());
$cao = clone $ao;
var_dump($cao->getFlags());
示例4: 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);
示例5: getFlags
/**
* Implementation of ArrayObject::getFlags().
*
* Gets the behavior flags of the ArrayObject. See the ArrayObject::setFlags
* method for a list of the available flags.
*
* @return int Returns the behavior flags of the ArrayObject.
*/
public function getFlags()
{
return $this->arrayObject->getFlags();
}