/** * @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); }
/** * 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; } }
/** * @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); }
/** * @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); }
/** * 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; }
/** * 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; }
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; }
/** * 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); } }
/** * 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()); }
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; }
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)); }
/** * {@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(); }
private function getListAsAnArrayObject($list) { if ($list instanceof ArrayIterator) { $list = new ArrayObject($list->getArrayCopy()); } return $list; }
/** * 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; }
public function render() { $retObj = new \ArrayObject($this->definition); $ret = $retObj->getArrayCopy(); $ret['data'] = $this->formatData(); return $ret; }
/** * HttpRequest class * Construct HTTP Request * @param String $queryString */ private function __construct(string $queryString) { $this->requestGet = new \ArrayObject(); $str_decodeUrl = str_replace("request=", "", urldecode($queryString)); $str_decodeUrl = rtrim($str_decodeUrl, ' /'); // yeap, with blank space $arr_moduleAction = explode('/', $str_decodeUrl); $int_totalModuleActions = count($arr_moduleAction); if (empty($str_decodeUrl)) { return; } if ($int_totalModuleActions <= 1) { $arr_moduleAction[] = 'index'; // if action not set, try to open index } if ($int_totalModuleActions > 2) { // Populating GET Request Parameters for ($i = 2; $i < $int_totalModuleActions; $i += 2) { $this->requestGet->offsetSet($arr_moduleAction[$i], isset($arr_moduleAction[$i + 1]) ? new String($arr_moduleAction[$i + 1]) : new String("")); } } $this->parsePostParameters(); $arr_moduleAction = new \ArrayObject($arr_moduleAction); $this->module = new String($arr_moduleAction->offsetGet(0)); if ($arr_moduleAction->offsetExists(1)) { $this->action = new String($arr_moduleAction->offsetGet(1)); } if ($arr_moduleAction->count() < 2) { return; } $this->request = new \ArrayObject(array_merge($this->requestGet->getArrayCopy(), $this->requestPost->getArrayCopy())); }
/** * Get flash messages, and reset storage * @return array Messages to show for current request */ public function flushMessages() { $messages = $this->storage->getArrayCopy(); // clear storage items. will attempt to handle multiple types here as // it seems that some types prefer get_object_vars if ($this->storage instanceof \ArrayObject) { foreach (get_object_vars($this->storage) as $key => $value) { $this->storage->offsetUnset($key); } } else { foreach ($this->storage as $key => $value) { $this->storage->offsetUnset($key); } } return $messages; }
/** * To list all enable states for this object. * @api * * @return string[] */ public function listEnabledStates() { if ($this->activesStates instanceof \ArrayAccess) { return array_keys($this->activesStates->getArrayCopy()); } else { return []; } }
/** * @param $qid * @return SurveyAnswer[] */ public function getAnswers($qid) { if (array_key_exists($qid, $this->map)) { $o = new \ArrayObject($this->map[$qid]); return $o->getArrayCopy(); } return null; }
public function search() { $query = $this->app->param("search", false); $list = new \ArrayObject([]); if ($query) { $this->app->trigger("cockpit.search", [$query, $list]); } return json_encode($list->getArrayCopy()); }
public function delete() { if (!isset($this->data)) { $this->lazyInitialization(); } foreach (array_keys($this->data->getArrayCopy()) as $key) { unset($this[$key]); } }
function bodyProperties() { $body_properties = []; foreach ($this->bodyProperties as $key => $val) { $body_properties[] = "{$key}=\"{$val}\""; } $body_properties[] = 'class="' . implode(' ', $this->bodyClasses->getArrayCopy()) . '"'; echo implode(' ', $body_properties); }
/** * Test ArrayObjectHandler::deserializeArrayObjectFromJson() * * @return void */ public function testDeserializeArrayObjectFromJson() { $serialized = ['a' => __LINE__, 'b' => __LINE__]; $deserialized = new \ArrayObject(['c' => __LINE__, 'd' => __LINE__]); $type = [__METHOD__]; $context = DeserializationContext::create(); $deserializationVisitor = $this->getMockBuilder('JMS\\Serializer\\JsonDeserializationVisitor')->disableOriginalConstructor()->setMethods(['visitArray'])->getMock(); $deserializationVisitor->expects($this->once())->method('visitArray')->with($serialized, $type, $context)->willReturn($deserialized->getArrayCopy()); $this->assertEquals($deserialized, (new ArrayObjectHandler())->deserializeArrayObjectFromJson($deserializationVisitor, $serialized, $type, $context)); }
/** * Create new object and initialise the variables. * * @param object $session_key * Session Key. * @param object $config_data * Config Data. */ protected function __construct($session_key, $config_data) { if (isset($config_data)) { $config_data_object = new ArrayObject($config_data); self::$public = $config_data_object->getArrayCopy(); } else { self::$public = array(); } self::$public['sessionKey'] = $session_key; }
/** * @param \ArrayObject $arrayObject * * @return array */ private function transformToArray(\ArrayObject $arrayObject) { $array = $arrayObject->getArrayCopy(); foreach ($array as $key => $value) { if ($value instanceof \ArrayObject) { $array[$key] = $this->transformToArray($value); } } return $array; }
/** * @inheritdoc */ public function getArrayCopy() { $array = array_filter(parent::getArrayCopy()); if (!empty($array['access'])) { $array['access'] = array_map(function (Scope $s) { return $s->getArrayCopy(); }, $array['access']); } return $array; }
/** * * * @param array $index * @param $storeId * @param $productIds * @return array */ protected function _addAdvancedIndexData(array $index, $storeId, $productIds) { $prefix = $this->_engine->getFieldsPrefix(); $prefixedCategoryData = $this->_getCatalogCategoryData($storeId, $productIds); $prefixedPriceData = $this->_getCatalogProductPriceData($productIds); $indexCollector = new ArrayObject(); $indexIterator = new ArrayIterator($index); iterator_apply($indexIterator, array($this, '_advancedIndexCallback'), array($indexIterator, $indexCollector, $prefix, $prefixedCategoryData, $prefixedPriceData)); return $indexCollector->getArrayCopy(); }
function test1() { $data = range(1, 10); $array = new ArrayObject($data); $i = new MyFilter($array->getIterator()); foreach ($i as $k => $v) { printf("%s => %s\n", $k, $v); } var_dump($array->getArrayCopy()); var_dump(iterator_to_array($i)); }
public function setSession(\Nethgui\Utility\SessionInterface $session) { /* @var $data \ArrayObject */ $data = $session->retrieve(__CLASS__); if ($data !== NULL) { /* @var $data \ArrayObject */ $this->data->exchangeArray(array_replace_recursive($data->getArrayCopy(), $this->data->getArrayCopy())); } $session->store(__CLASS__, $this->data); return $this; }
/** * __get() - Overload the model * @param string $name property we're tying to get * @return mixed */ public function __get($name) { if ($name == 'response') { return $this->_arrayToObject($this->responseTemplate); } if ($name == 'request') { $request = new ArrayObject($this->requestTemplate); return $request->getArrayCopy(); } parent::__get($name); }