本文整理汇总了PHP中Registry::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::toArray方法的具体用法?PHP Registry::toArray怎么用?PHP Registry::toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::toArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItem
public function getItem($pk = null)
{
$pk = !empty($pk) ? $pk : (int) JFactory::getApplication()->input->getint('id');
$table = $this->getTable();
if ($pk > 0) {
// Attempt to load the row.
$return = $table->load($pk);
// Check for a table object error.
if ($return === false && $table->getError()) {
$this->setError($table->getError());
return false;
}
}
// Convert to the JObject before adding other data.
$properties = $table->getProperties(1);
$item = JArrayHelper::toObject($properties, 'JObject');
if (property_exists($item, 'params')) {
$registry = new Registry();
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
return $item;
}
示例2: format
/**
* format - prune the registry based on xml config
*
* @param string XMLpath
* @param Registry registry
*
* @return array
*/
public static function format($xmlFilePath, $uri, Registry $registry)
{
$xml = file_get_contents($xmlFilePath);
$xmlParser = new XMLParser();
$params = $xmlParser->parse($xml, $uri, 'outputParam');
unset($xmlParser);
$output = array();
if (count($params) < 1) {
if (self::PARANOID_MODE) {
error_log('XML is missing CherryPicker configs for ' . $uri);
throw new XMLNodeNotConfiguredException('XML is missing CherryPicker configs for ' . $uri);
}
//not paranoid? ok - dump the whole registry to the user
foreach ($registry->toArray() as $key => $value) {
$output[self::trimNamespacing($key)] = $registry->{$key};
}
return $output;
}
foreach ($params as $key) {
self::formatValue($key, $output, $registry);
}
return $output;
}
示例3: merge
/**
* Merge a Registry object into this one
*
* @param Registry $source Source Registry object to merge. [@note Framework typehints this param]
* @param boolean $recursive True to support recursive merge the children values.
*
* @return Registry Return this object to support chaining.
*
* @since 1.0
*/
public function merge($source, $recursive = false)
{
if (!$source instanceof Registry) {
return false;
}
$data = $source->toArray();
$array = array();
foreach ($data as $k => $v) {
if ($v !== null && $v !== '') {
$array[$k] = $v;
}
}
$this->bindData($this->data, $array, $recursive);
return $this;
}