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);
     }
 }
 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();
     }
 }
Beispiel #3
0
 /**
  * {@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);
 }
Beispiel #4
0
 /**
  * @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);
 }
 /**
  * @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;
 }
Beispiel #6
0
    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');
    }
Beispiel #7
0
 /**
  * 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);
 }
Beispiel #8
0
 /**
  * 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);
 }
Beispiel #9
0
 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();
     });
 }
 /**
  * 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);
 }
 /**
  * @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;
 }
Beispiel #12
0
 public static final function map(\Traversable $traversable, UnaryFunktionInterface $functor) : \Traversable
 {
     $result = new \ArrayIterator();
     foreach ($traversable as $value) {
         $result->append($functor->apply($value));
     }
     return $result;
 }
Beispiel #13
0
Datei: Set.php Projekt: volux/dom
 /**
  * @param mixed $value
  *
  * @return $this
  */
 public function append($value)
 {
     if (is_scalar($value)) {
         $value = $this->ownerDocument->createText($value);
     }
     parent::append($value);
     return $this;
 }
Beispiel #14
0
 /**
  * @return array|\ArrayIterator
  */
 public function getKeys()
 {
     $keys = new \ArrayIterator();
     foreach ($this as $key => $row) {
         $keys->append($key);
     }
     return $keys;
 }
Beispiel #15
0
 /**
  * {@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);
 }
Beispiel #16
0
 /**
  * @param Tx_Asdis_Domain_Model_Asset $asset
  */
 public function append(Tx_Asdis_Domain_Model_Asset $asset)
 {
     $elementHash = $asset->getHash();
     if (in_array($elementHash, $this->elementHashes)) {
         return;
     }
     $this->elementHashes[] = $elementHash;
     parent::append($asset);
 }
Beispiel #17
0
 /**
  * Finder::getIterator() alias
  *
  * @return \ArrayIterator $sets
  */
 public function getAll()
 {
     $sets = new \ArrayIterator();
     $iterator = $this->getIterator();
     foreach ($iterator as $set) {
         $sets->append(new Set($set));
     }
     return $sets;
 }
 public function getAnswersIterator()
 {
     $answers = $this->section["answers"];
     $iterator = new \ArrayIterator();
     while (list($sectionId, $reply) = each($answers)) {
         $iterator->append(new DialogAnswer($sectionId, $reply));
     }
     return $iterator;
 }
Beispiel #19
0
 /**
  * Set photo content getter
  * 
  * @return \ArrayIterator $photos
  */
 public function getAll()
 {
     $photos = new \ArrayIterator();
     $iterator = $this->getIterator();
     foreach ($iterator as $photo) {
         $photos->append($photo->getFileInfo('\\Smak\\Portfolio\\Photo'));
     }
     return $photos;
 }
 public function getFullNames()
 {
     $files = $this->build();
     $fullNames = new \ArrayIterator();
     foreach ($files as $key => $value) {
         $fullNames->append(ltrim($value[0], '/') . '/' . $value[1]);
     }
     return $fullNames;
 }
 /**
  * @param $transformed
  */
 public function append($transformed)
 {
     if (is_array($transformed)) {
         foreach ($transformed as $value) {
             parent::append($value);
         }
     } else {
         parent::append($transformed);
     }
 }
Beispiel #22
0
 /**
  * @inheritDoc
  */
 public function collect() : \Iterator
 {
     $iterator = new \ArrayIterator();
     $routes = ['homepage', 'products_filter', 'products', 'cart', 'profile'];
     foreach ($this->locales as $locale) {
         foreach ($routes as $route) {
             $iterator->append($this->router->generate($route, ['_locale' => $locale], RouterInterface::ABSOLUTE_URL));
         }
     }
     return $iterator;
 }
Beispiel #23
0
 public function readElements()
 {
     $iterator = new \ArrayIterator();
     do {
         $object = $this->readElement();
         if ($object) {
             $iterator->append($object);
         }
     } while ((bool) $object);
     $objects = $iterator;
     return $objects;
 }
Beispiel #24
0
 /**
  * @param TerminalOperationInterface $terminal
  *
  * @return mixed
  */
 private function solveOperationsAndApplyTerminal(TerminalOperationInterface $terminal)
 {
     // When we have not a single operation in the chain we add a dummy one, in order to map down multiple input
     // living inside the \AppendIterator (in case we have multiple inputs)
     if (count($this->operationChain) === 0) {
         $this->operationChain->append(new EmptyIntermediateOp());
     }
     $iterator = $this->factory->createIterator($this->inputs, $this->options);
     $solver = $this->factory->createSolver();
     $result = $solver->solve($this->operationChain, $iterator);
     return $terminal->apply($result);
 }
 /**
  * @return \Iterator
  */
 public function getIterator()
 {
     $iterator = parent::getIterator();
     $files = new \ArrayIterator();
     foreach ($iterator as $file) {
         $file = PhpFileInfo::create($file);
         if (null !== $this->parser) {
             $this->parser->parseFile($file);
         }
         $files->append($file);
     }
     return $files;
 }
Beispiel #26
0
 /**
  * @covers ::run
  */
 public final function testRunnerShouldRunConnectorsWithGivenParametersWhenAskedToRun()
 {
     $runner = $this->runner;
     $mockConnector = $this->getMockConnector();
     /** @var FilesystemInterface|\PHPUnit_Framework_MockObject_MockObject $mockFileSystem */
     $mockFileSystem = $this->getMock(FilesystemInterface::class);
     $changeList = ['foo', 'bar', 'baz'];
     $mockConnector->expects($this->exactly(3))->method('run')->with($mockFileSystem, $changeList);
     $this->iterator->append($mockConnector);
     $this->iterator->append($mockConnector);
     $this->iterator->append($mockConnector);
     $runner->run($mockFileSystem, $changeList);
 }
Beispiel #27
0
 /**
  * Append entities to collection
  *
  * @param Entity|Collection|Traversable|array $data entity or list of entities to append
  * @access public
  *
  * @return Collection
  */
 public function append($data)
 {
     if (is_array($data) || $data instanceof \Traversable) {
         foreach ($data as $entity) {
             if (!$entity instanceof Entity) {
                 throw new InvalidArgumentException('Collection can contain only Entities class');
             }
             parent::append($entity);
         }
     } else {
         parent::append($data);
     }
     return $this;
 }
 /**
  * @see \Hofff\Contao\Selectri\Model\Data::browseFrom()
  *
  * @param null $chunks
  *
  * @return array
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function browseFrom($chunks = null)
 {
     $listData = new SQLListData($this->getWidget(), $this->getDatabase(), $this->prepareListDataConfig($chunks));
     list($eventMonthLevels, $key) = $listData->browseFrom(null);
     $levels = new \ArrayIterator();
     while ($newsArchive = $eventMonthLevels->current()) {
         $node = $newsArchive->getData();
         $node['_isSelectable'] = false;
         $node['_key'] = implode('::', array_merge($chunks, array('month', $node['month'])));
         $listNode = new SQLListSelectAbleNode($listData, $node);
         $levels->append($listNode);
         $eventMonthLevels->next();
     }
     return array($levels, implode('::', $chunks));
 }
 protected function parseRSSATOM($nb = null)
 {
     $retour = new ArrayIterator();
     $newsList = null;
     if ($this->feed_type == self::FEED_TYPE_RSS) {
         $newsList = $this->xml_doc->channel->item;
     } elseif ($this->feed_type == self::FEED_TYPE_ATOM) {
         $newsList = $this->xml_doc->entry;
     }
     $i = 0;
     foreach ($newsList as $item) {
         $retour->append(new ArrayObject((array) $item, ArrayObject::ARRAY_AS_PROPS));
         if ($nb != null && intval($nb) == ++$i) {
             break;
         }
     }
     return $retour;
 }
Beispiel #30
0
 /**
  * Returns an Iterator for the current Finder configuration.
  *
  * This method implements the IteratorAggregate interface.
  *
  * @return \Iterator An iterator
  *
  * @throws \LogicException if the setContainer() method has not been called
  */
 public function getIterator($ns = 'BackBee\\Console\\Command')
 {
     if (null === $this->container) {
         throw new \LogicException('You must call setContainer() before iterating over this finder.');
     }
     $iterator = parent::getIterator();
     $result = new \ArrayIterator();
     foreach ($iterator as $file) {
         if ($relativePath = $file->getRelativePath()) {
             $ns .= '\\' . strtr($relativePath, '/', '\\');
         }
         $r = new \ReflectionClass($ns . '\\' . $file->getBasename('.php'));
         if ($r->isSubclassOf('BackBee\\Console\\AbstractCommand') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) {
             $result->append($r->newInstance());
         }
     }
     return $result;
 }