本文整理汇总了PHP中Container::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::toArray方法的具体用法?PHP Container::toArray怎么用?PHP Container::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container::toArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testApply
public function testApply()
{
$config = ["level1" => ["level2" => ["level3" => "123"], "level2-1" => ["level3-1" => "321"]]];
$object = new Container($config);
$this->assertEquals("123", $object->level1["level2"]->level3);
$reverse = function ($v) {
return strrev($v);
};
$object->apply(["level1" => ["level2" => ["level3" => $reverse], "level2-1" => ["level3-1" => $reverse]]]);
$compare = ["level1" => ["level2" => ["level3" => "321"], "level2-1" => ["level3-1" => "123"]]];
$this->assertEquals($compare, $object->toArray());
$object->apply(function () {
return null;
});
$this->assertEquals(["level1" => null], $object->toArray());
}
示例2: toArray
/**
* @return array
*/
public function toArray()
{
$tmp = new Container(null, []);
foreach ($this->changesTracker as $itemKey => $opType) {
if ($opType == ITEM_OPERATION_ADD || $opType == ITEM_OPERATION_NEW_VALUE) {
$tmp->set($this->get($itemKey));
}
}
return $tmp->toArray();
}
示例3: toArray
/**
* Returns an array representation of the page
*
* @return array associative array containing all page properties
*/
public function toArray()
{
return array_merge($this->getCustomProperties(), array('label' => $this->getlabel(), 'fragment' => $this->getFragment(), 'id' => $this->getId(), 'class' => $this->getClass(), 'title' => $this->getTitle(), 'target' => $this->getTarget(), 'accesskey' => $this->getAccesskey(), 'rel' => $this->getRel(), 'rev' => $this->getRev(), 'customHtmlAttribs' => $this->getCustomHtmlAttribs(), 'order' => $this->getOrder(), 'resource' => $this->getResource(), 'privilege' => $this->getPrivilege(), 'active' => $this->isActive(), 'visible' => $this->isVisible(), 'type' => get_class($this), 'pages' => parent::toArray()));
}
示例4: save
public function save(Container $row)
{
$id = isAke($row->toArray(), 'id', null);
return is_null($id) ? $this->add($row) : $this->insertRow($this->toArray($row));
}
示例5: toArray
/**
* {@inheritdoc}
*/
public function toArray()
{
$this->fillSpan();
return parent::toArray();
}
示例6: mergeBlueObject
/**
* allow to join two blue objects into one
*
* @param \BlueContainer\Container $object
* @return $this
*/
public function mergeBlueObject(Container $object)
{
$newData = $object->toArray();
foreach ($newData as $key => $value) {
$this->appendData($key, $value);
}
$this->_dataChanged = true;
return $this;
}