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


PHP ArrayObject::setFlags方法代码示例

本文整理汇总了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;
 }
开发者ID:Chaireeee,项目名称:chaireeee,代码行数:25,代码来源:SplCaster.php

示例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();
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:16,代码来源:UserChat.php

示例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;
}
开发者ID:jonathan1212,项目名称:zf2,代码行数:14,代码来源:function.php

示例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;
}
开发者ID:ApprovedTOPKEK,项目名称:Item-Set-Manager,代码行数:22,代码来源:GlobalUtils.php

示例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;
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:18,代码来源:SplCaster.php

示例6: setFlags

 function setFlags($flags)
 {
     echo __METHOD__ . "({$flags})\n";
     ArrayObject::setFlags($flags);
 }
开发者ID:gleamingthecube,项目名称:php,代码行数:5,代码来源:ext_spl_tests_array_017.php

示例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);
开发者ID:voituk,项目名称:Misc,代码行数:8,代码来源:ArrayObject.test.php

示例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);
开发者ID:badlamer,项目名称:hhvm,代码行数:13,代码来源:getFlags.php

示例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;
?>

开发者ID:jestintab,项目名称:zendphp,代码行数:11,代码来源:arrayIterator-flag.php

示例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);
 }
开发者ID:pbull,项目名称:acquia-platform-cloud-data-model,代码行数:13,代码来源:ArrayObjectImplementationMethods.php

示例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;
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:26,代码来源:Source.php


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