本文整理匯總了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();
}