本文整理汇总了PHP中ArrayObject::getArrayCopy方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayObject::getArrayCopy方法的具体用法?PHP ArrayObject::getArrayCopy怎么用?PHP ArrayObject::getArrayCopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayObject
的用法示例。
在下文中一共展示了ArrayObject::getArrayCopy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uri
/**
* @return Uri
*/
public function uri()
{
$query = "";
$query .= $this->paramsLoginToQuery();
$query .= $this->paramsOther();
$query .= "&sch_del=" . implode(",", $this->id->getArrayCopy());
return new Uri($this->proxy->getProtocol(), $this->proxy->getHost(), $this->proxy->getPort(), "/api/vms.do", $query);
}
示例2: getData
/**
* retrieve the data-storage
* @param bool $arrayCopy
* @return array|\ArrayObject
*/
protected function getData($arrayCopy = false)
{
if ($arrayCopy) {
return $this->_data->getArrayCopy();
} else {
return $this->_data;
}
}
示例3: uri
/**
* @return Uri
*/
public function uri()
{
$query = "";
$query .= $this->paramsLoginToQuery();
$query .= $this->paramsOther();
if (count($this->groups) > 0) {
$query .= "&groups=" . implode(",", $this->groups->getArrayCopy());
}
return new Uri($this->proxy->getProtocol(), $this->proxy->getHost(), $this->proxy->getPort(), "/api/phonebook.do", $query);
}
示例4: uri
/**
* @return Uri
*/
public function uri()
{
$query = "";
$query .= $this->paramsLoginToQuery();
$query .= $this->paramsOther();
if (!empty($this->groups)) {
$query .= "&groups=" . implode(";", $this->groups->getArrayCopy());
}
$query .= "&list_contacts=1";
return new Uri($this->proxy->getProtocol(), $this->proxy->getHost(), $this->proxy->getPort(), "/api/phonebook.do", $query);
}
示例5: sortBy
/**
* Sort by column name
* @param mixed $column
* @param bool $ascending
* @return bool Information about the sort of success
*/
public function sortBy($column, $ascending = true)
{
$sortBy = array();
foreach ($this->data as $key => $row) {
if (!isset($row[$column])) {
return false;
}
$sortBy[$key] = $row[$column];
}
$array = $this->data->getArrayCopy();
array_multisort($sortBy, $ascending ? SORT_ASC : SORT_DESC, $array);
$this->data = new \ArrayObject($array);
return true;
}
示例6: get
/**
* Get an item from an array using "dot" notation.
*
* @param string|integer $index The index or identifier.
* @param mixed $default
*
* @return mixed|null
*/
public static function get($index, $default = null)
{
if (self::$battery->offsetExists($index)) {
return self::$battery->offsetGet($index);
}
$array = self::$battery->getArrayCopy();
foreach ((array) explode('.', $index) as $segment) {
if (!is_array($array) || !array_key_exists($segment, $array)) {
return $default;
}
$array = $array[$segment];
}
return $array;
}
示例7: compile
public function compile($name)
{
$source = $this->getLoader()->getSource($name);
$cacheKey = $this->getCacheFilename($name);
$phpStr = '';
try {
$this->partials->exchangeArray([new FileResource($this->getLoader()->getCacheKey($name))]);
$phpStr = LightnCandy::compile($source, $this->options);
} catch (\Exception $e) {
throw new LoaderException($e->getMessage());
}
$this->cache->write($cacheKey, '<?php // ' . $name . PHP_EOL . $phpStr, $this->partials->getArrayCopy());
return $phpStr;
}
示例8: languageAndWorkspaceOverlay
/**
* Do translation and workspace overlay
*
* @param \ArrayObject $data
* @return void
*/
public function languageAndWorkspaceOverlay(\ArrayObject $data)
{
$overlayedMetaData = $this->getTsfe()->sys_page->getRecordOverlay('sys_file_metadata', $data->getArrayCopy(), $this->getTsfe()->sys_language_content, $this->getTsfe()->sys_language_contentOL);
if ($overlayedMetaData !== NULL) {
$data->exchangeArray($overlayedMetaData);
}
}
示例9: listRegisteredFactory
/**
* To return all registered factories.
* @api
* @return string[]|array
*/
public static function listRegisteredFactory()
{
if (!static::$factoryRegistry instanceof \ArrayAccess) {
return array();
}
return array_keys(static::$factoryRegistry->getArrayCopy());
}
示例10: 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;
}
示例11: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title('Exporting databases');
$io->section('Exporting all databases');
$strategies = $this->collectorDbStrategy->collectDatabasesStrategies();
$totalStrategies = count($strategies);
$io->writeln($totalStrategies . ' strategie(s) found.');
$progressBar = new ProgressBar($output, $totalStrategies);
$progressBar->setFormat(self::PROGRESS_BAR_FORMAT);
$progressBar->setMessage('Beginning backuping');
$this->eventDispatcher->dispatch(Events::BACKUP_BEGINS, new BackupBeginsEvent($output));
$progressBar->start();
$reportContent = new \ArrayObject();
foreach ($strategies as $strategy) {
$strategyIdentifier = $strategy->getIdentifier();
$setProgressBarMessage = function ($message) use($progressBar, $strategyIdentifier) {
$message = "[{$strategyIdentifier}] {$message}";
$progressBar->setMessage($message);
$progressBar->display();
};
$exportedFiles = $this->processorDatabaseDumper->dump($strategy, $setProgressBarMessage);
$reportContent->append("Backuping of the database: {$strategyIdentifier}");
foreach ($exportedFiles as $file) {
$filename = $file->getPath();
$reportContent->append("\t→ {$filename}");
}
$progressBar->advance();
}
$progressBar->finish();
$io->newLine(2);
$io->section('Report');
$io->text($reportContent->getArrayCopy());
$this->eventDispatcher->dispatch(Events::BACKUP_ENDS, new BackupEndsEvent($output));
}
示例12: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
// Set filters & get data
$type = $input->getArgument(self::TYPE_ARGUMENT);
if ($type) {
$this->productlist->setType($type);
}
$active = $input->getOption(self::ACTIVE_OPTION);
if ($active) {
$this->productlist->setStatus(1);
}
$products = $this->productlist->getProducts();
// If only count, return it
if ($input->getOption(self::COUNT_OPTION)) {
return $output->writeln(sprintf('Count: %d', $products->getTotalCount()));
}
// Else prepare data for showing
$types = $this->productlist->getProductTypesAssoc();
$rows = new \ArrayObject();
foreach ($products->getItems() as $id => $product) {
$rows->append([$product->getId(), $product->getSku(), $product->getName(), $types[$product->getTypeId()]]);
}
// Output table layout
$table = new Table($output);
$table->setHeaders(['ID', 'SKU', 'Name', 'Type']);
$table->setRows($rows->getArrayCopy());
$table->render();
}
示例13: getListAsAnArrayObject
private function getListAsAnArrayObject($list)
{
if ($list instanceof ArrayIterator) {
$list = new ArrayObject($list->getArrayCopy());
}
return $list;
}
示例14: deleteConstant
/**
* Delete constant from constant list
*
* @param string $constant
*
* @return bool
*/
public function deleteConstant($constant)
{
if (($index = array_search($constant, $this->constants->getArrayCopy())) !== false) {
$this->constants->offsetUnset($index);
}
return $index !== false;
}
示例15: render
public function render()
{
$retObj = new \ArrayObject($this->definition);
$ret = $retObj->getArrayCopy();
$ret['data'] = $this->formatData();
return $ret;
}