本文整理汇总了PHP中ArrayIterator::append方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayIterator::append方法的具体用法?PHP ArrayIterator::append怎么用?PHP ArrayIterator::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayIterator
的用法示例。
在下文中一共展示了ArrayIterator::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setItems
private function setItems()
{
$this->items = new ArrayIterator();
foreach ($this->rss->channel->item as $onlyItem) {
$item = new RssItem($onlyItem->title, $onlyItem->link, $onlyItem->pubDate, $onlyItem->description);
$this->items->append($item);
}
}
示例2: dayInfo
private function dayInfo()
{
$this->daysInfo = new ArrayIterator();
while ($this->days->valid()) {
$day = explode(") - ", $this->days->current());
$infos = explode("/", $day[1]);
$this->daysInfo->append($this->buildWeatherDayInfo($day[0], $infos));
$this->days->next();
}
}
示例3: append
/**
* {@inheritdoc}
* @see ArrayIterator::append()
*/
public function append($value)
{
if (!is_a($value, $this->getClass())) {
throw new \InvalidArgumentException(sprintf('Only ' . $this->getClass() . ' object is allowed!'));
}
parent::append($value);
}
示例4: append
/**
* @param QueryBuilder $qb A QueryBuilder instance
*/
public function append($qb)
{
if (!$qb instanceof QueryBuilder) {
throw new \InvalidArgumentException("QuerySet will only accept QueryBuilder instances", 1);
}
parent::append($qb);
}
示例5: solveIntermediateOperationChain
/**
* @param \Iterator $operatorChain
* @param \Iterator $input
*
* @return \ArrayIterator
*/
private function solveIntermediateOperationChain(\Iterator $operatorChain, \Iterator $input)
{
$results = new \ArrayIterator();
$input->rewind();
$continueWIthNextItem = true;
while ($input->valid() && $continueWIthNextItem) {
$result = $input->current();
$useResult = true;
// do the whole intermediate operation chain for the current input
$operatorChain->rewind();
while ($operatorChain->valid() && $useResult) {
/** @var IntermediateOperationInterface $current */
$current = $operatorChain->current();
// apply intermediate operations
$result = $current->apply($result, $input->key(), $useResult, $returnedCanContinue);
// track the continuation flags
$continueWIthNextItem = $continueWIthNextItem && $returnedCanContinue;
// iterate
$operatorChain->next();
}
if ($useResult) {
$results->append($result);
}
// goto next item
$input->next();
}
return $results;
}
示例6: setUp
public function setUp()
{
$data = <<<ENDXML
<permcheck>
<excludes>
<file>excluded/file5.txt</file>
<dir>excluded2</dir>
</excludes>
<executables>
<file>file1.sh</file>
<file>file3.sh</file>
</executables>
</permcheck>
ENDXML;
$this->config = \Mockery::mock(new Config());
$this->loader = \Mockery::mock(new XmlLoader($data, $this->config));
$this->fileSystem = \Mockery::mock(new Filesystem($this->config, '/does/not/exist'));
$files = new \ArrayIterator();
$mocks = array('/does/not/exist/file1.sh' => array(true, false), '/does/not/exist/file2.txt' => array(false, false), '/does/not/exist/file3.sh' => array(false, false), '/does/not/exist/file4.txt' => array(true, false), '/does/not/exist/excluded/file5.txt' => array(true, false), '/does/not/exist/excluded2/file6.sh' => array(false, false), '/does/not/exist/symlink' => array(true, true));
foreach ($mocks as $file => $properties) {
/** @var MockInterface|\SplFileInfo $file */
$file = \Mockery::mock(new \SplFileInfo($file));
$file->shouldReceive('getName')->andReturn($file);
$file->shouldReceive('isExecutable')->andReturn($properties[0]);
$file->shouldReceive('isLink')->andReturn($properties[1]);
$files->append($file);
}
$this->fileSystem->shouldReceive('getFiles')->andReturn($files);
$this->messageBag = \Mockery::mock(new Bag());
$this->reporter = \Mockery::mock(new XmlReporter());
$this->permCheck = new PermCheck($this->loader, $this->config, $this->fileSystem, $this->messageBag, $this->reporter, '/does/not/exist');
}
示例7: append
/**
* Bloqueia a inclusão de objetos que não seja do tipo Transaction
*
* @param Transaction $value
* @throws Exception
*/
public function append($value)
{
if (!$value instanceof Transaction) {
throw new \InvalidArgumentException('Transaction object expected');
}
return parent::append($value);
}
示例8: smartmobileFolderTree
/**
* AJAX action: Check access rights for creation of a submailbox.
*
* Variables used:
* - all: (integer) If 1, return all mailboxes. Otherwise, return only
* INBOX, special mailboxes, and polled mailboxes.
*
* @return string HTML to use for the folder tree.
*/
public function smartmobileFolderTree()
{
$ftree = $GLOBALS['injector']->getInstance('IMP_Ftree');
/* Poll all mailboxes on initial display. */
$this->_base->queue->poll($ftree->poll->getPollList(), true);
$iterator = new AppendIterator();
/* Add special mailboxes explicitly. INBOX should appear first. */
$special = new ArrayIterator();
$special->append($ftree['INBOX']);
foreach (IMP_Mailbox::getSpecialMailboxesSort() as $val) {
if (isset($ftree[$val])) {
$special->append($ftree[$val]);
}
}
$iterator->append($special);
/* Now add polled mailboxes. */
$filter = new IMP_Ftree_IteratorFilter($ftree);
$filter->add(array($filter::CONTAINERS, $filter::REMOTE, $filter::SPECIALMBOXES));
if (!$this->vars->all) {
$filter->add($filter::POLLED);
}
$filter->mboxes = array('INBOX');
$iterator->append($filter);
return $ftree->createTree($this->vars->all ? 'smobile_folders_all' : 'smobile_folders', array('iterator' => $iterator, 'render_type' => 'IMP_Tree_Jquerymobile'))->getTree(true);
}
示例9: execute
public function execute(InputInterface $input, OutputInterface $output)
{
$configuration = new Configuration(file_get_contents(__DIR__ . '/../../../config/config.json'));
$resolver = new SpawnResolver($configuration, CpuInfo::detect());
$factory = new Factory();
$classname = $resolver->getClassName();
if ($input->getOption('verbose')) {
$outputLogger = new StreamHandler('php://stdout');
} else {
$outputLogger = new NullHandler();
}
$workers = new \ArrayIterator();
for ($i = 1; $i <= $resolver->getSpawnQuantity(); $i++) {
$output->write("Launching Worker <info>{$i}</info> ...");
$logger = new Logger('Worker-' . $i);
$logger->pushHandler($outputLogger);
$logger->pushHandler(new RotatingFileHandler(__DIR__ . '/../../../logs/worker-' . $i . '.logs', 3));
$worker = new Worker('Worker-' . $i, new \GearmanWorker(), $logger);
foreach ($configuration['gearman-servers'] as $server) {
$worker->addServer($server['host'], $server['port']);
}
$worker->setFunction(new $classname($configuration, $logger, $factory));
$workers->append($worker);
$output->writeln("Success !");
}
$manager = new ProcessManager(new EventDispatcher());
$manager->process($workers, function (Worker $worker) {
$worker->run();
});
}
示例10: append
/**
* Appends a new collection entry
*
* @param \MarkdownExtended\API\ContentInterface $content
*
* @throws \MarkdownExtended\Exception\UnexpectedValueException it the argument does not implement `\MarkdownExtended\API\ContentInterface`
*/
public function append($content)
{
if (!is_object($content) || !Kernel::valid($content, Kernel::TYPE_CONTENT)) {
throw new UnexpectedValueException(sprintf('Method "%s" expects a "%s" parameter object, got "%s"', __METHOD__, Kernel::CONTENT_INTERFACE, is_object($content) ? get_class($content) : gettype($content)));
}
parent::append($content);
}
示例11: mapNotificationDevices
/**
* @param NotificationEntity $notificationEntity
* @return \ArrayIterator
*/
protected function mapNotificationDevices(NotificationEntity $notificationEntity)
{
$devices = new \ArrayIterator();
foreach ($notificationEntity->getDevices() as $device) {
$devices->append($this->deviceMapper->mapEntityToModel($device, $notificationEntity->getType()));
}
return $devices;
}
示例12: map
public static final function map(\Traversable $traversable, UnaryFunktionInterface $functor) : \Traversable
{
$result = new \ArrayIterator();
foreach ($traversable as $value) {
$result->append($functor->apply($value));
}
return $result;
}
示例13: append
/**
* @param mixed $value
*
* @return $this
*/
public function append($value)
{
if (is_scalar($value)) {
$value = $this->ownerDocument->createText($value);
}
parent::append($value);
return $this;
}
示例14: getKeys
/**
* @return array|\ArrayIterator
*/
public function getKeys()
{
$keys = new \ArrayIterator();
foreach ($this as $key => $row) {
$keys->append($key);
}
return $keys;
}
示例15: append
/**
* {@inheritdoc}
* @see ArrayIterator::append()
*/
public function append($value)
{
$strictClass = $this->getClass();
if ($strictClass !== null && !is_a($value, $strictClass)) {
throw new \InvalidArgumentException(sprintf('Only %s object is allowed to append!', $strictClass));
}
parent::append($value);
}