public function onEventProcessingFailed(array $eventMessages, \Exception $cause = null) { $this->delegates->rewind(); while ($this->delegates->valid()) { $delegate = $this->delegates->current(); $delegate->onEventProcessingFailed($eventMessages, $cause); $this->delegates->next(); } }
public function execute(&$request, &$response) { if ($this->_filters->valid()) { /* @var $current Filter */ $current = $this->_filters->current(); $this->_filters->next(); $current->execute($request, $response, $this); } }
/** * * Registers all the image sizes added * * @author Tim Perry * */ public function registerImageSizes() { $this->sizes->rewind(); while ($this->sizes->valid()) { $imageSize = $this->sizes->current(); add_image_size($imageSize->getName(), $imageSize->getWidth(), $imageSize->getHeight(), $imageSize->getCrop()); $this->sizes->next(); } }
/** * Registers all the field groups added * @author Tim Perry */ public function hookUp() { $this->hookables->rewind(); while ($this->hookables->valid()) { $hookable = $this->hookables->current(); $hookable->hookUp(); $this->hookables->next(); } }
/** * @return RangeFile[] */ private function getAllFiles() { $all = []; $this->map->rewind(); while ($this->map->valid() === true) { array_push($all, $this->map->getInfo()); $this->map->next(); } return $all; }
/** * Adds all the functions into the twig environment * * @param \Twig_Environment $twig * @return \Twig_Environment * @author Tim Perry */ public function getTwig(\Twig_Environment $twig) { $this->functions->rewind(); while ($this->functions->valid()) { $function = $this->functions->current(); $twig->addFunction(new \Twig_SimpleFunction($function->getFunctionName(), array($function, 'getFunctionBody'))); $this->functions->next(); } return $twig; }
/** * Iterates through user storage until certain $id is found. * * @param $id * * @return User * * @throws UserNotFoundException */ public function find(UserId $id) { $this->users->rewind(); while ($this->users->valid()) { $user = $this->users->current(); if ($user->getId()->equals($id)) { return $user; } $this->users->next(); } throw new UserNotFoundException(sprintf('User with id %d not found.', $id->id())); }
/** * Registers all the taxonomies added */ public function registerTaxonomies() { if (!function_exists('register_taxonomy')) { return; } $this->taxonomies->rewind(); while ($this->taxonomies->valid()) { $taxonomy = $this->taxonomies->current(); register_taxonomy($taxonomy->getName(), $taxonomy->getSupportedPostTypes(), $taxonomy->getArgs()); $this->taxonomies->next(); } }
/** * Registers all the post types added * @author Tim Perry */ public function registerPostTypes() { if (!function_exists('register_post_type')) { return; } $this->postTypes->rewind(); while ($this->postTypes->valid()) { $postType = $this->postTypes->current(); register_post_type($postType->getName(), $postType->getArgs()); $this->postTypes->next(); } }
/** * @param $pos * * @return null|AbstractSQLConnection */ public function getConnectionByPosition($pos) { $pos = (int) $pos; $this->storage->rewind(); for ($i = 0; $this->storage->count() > $i; $i++) { if ($i === $pos) { return $this->storage->current(); } $this->storage->next(); } return null; }
/** * Registers all the meta boxes added * @author Tim Perry */ public function addMetaBoxes() { $this->metaBoxes->rewind(); while ($this->metaBoxes->valid()) { $metaBox = $this->metaBoxes->current(); foreach ($metaBox->getSupportedPostTypes() as $postType) { add_meta_box($metaBox->getID(), $metaBox->getTitle(), array($metaBox, 'getCallback'), $postType, $metaBox->getContext(), $metaBox->getPriority(), $metaBox->getCallbackArgs()); add_action('save_post', array($metaBox, 'savePostCallback')); } $this->metaBoxes->next(); } }
/** * Registers all shortcodes added * @author Tim Perry */ public function registerShortcodes() { if (!function_exists('add_shortcode')) { return; } $this->shortcodes->rewind(); while ($this->shortcodes->valid()) { $shortcode = $this->shortcodes->current(); add_shortcode($shortcode->getName(), array($shortcode, 'getCallback')); $this->shortcodes->next(); } }
/** * Registers all the field groups added * * @author Tim Perry */ public function registerFieldGroups() { if (!function_exists('register_field_group')) { return; } $this->fieldGroups->rewind(); while ($this->fieldGroups->valid()) { $field = $this->fieldGroups->current(); register_field_group($field->getConfig()); $this->fieldGroups->next(); } }
/** * @return int */ public function getNumberOfAdvancedCourses() : int { $advancedCourses = 0; $this->courses->rewind(); while ($this->courses->valid()) { $course = $this->courses->current(); if ($course->isAdvanced()) { $advancedCourses++; } $this->courses->next(); } return $advancedCourses; }
public static function clearAllCaches() { self::clearCache(); self::$__caches->rewind(); while (self::$__caches->valid()) { self::$__caches->setInfo([]); self::$__caches->next(); } }
/** * Runs after all steps have been processed bay calling post process method on all steps. * * @param \WCM\WPStarter\Setup\IO $io */ public function postProcess(IO $io) { $this->postProcessSteps->rewind(); while ($this->postProcessSteps->valid()) { /** @var \WCM\WPStarter\Setup\Steps\PostProcessStepInterface $step */ $step = $this->postProcessSteps->current(); $step->postProcess($io); $this->postProcessSteps->next(); } }
private function eventsToPublish() { $events = array(); $this->eventsToPublish->rewind(); while ($this->eventsToPublish->valid()) { $events = array_merge($events, $this->eventsToPublish->getInfo()); $this->eventsToPublish->next(); } return $events; }
/** * @param null|mixed|array $models (optional) */ public function commit($models = null) { $pool = $this->manager->getPool(); /** @var ObjectManager[] $managers */ $managers = $pool->getIterator(); if (null === $models) { foreach ($managers as $manager) { $manager->flush(); } if (!$this->models->count()) { return; } $this->models->rewind(); while ($this->models->valid()) { $model = $this->models->current(); $class = $this->manager->getClassMetadata(get_class($model)); $managerName = $class->getManagerReferenceGenerator(); $ref = call_user_func(array($model, 'get' . ucfirst($managerName))); $id = call_user_func(array($ref, 'get' . ucfirst($class->getIdentifierReference($managerName)->referenceField))); foreach ($this->models->getInfo() as $managerName) { $this->saveSpecificModel($model, $managerName, $id); } $this->models->next(); } // clear list $this->models = new \SplObjectStorage(); } else { if (!is_array($models)) { $models = array($models); } foreach ($models as $model) { $class = $this->manager->getClassMetadata(get_class($model)); $managerName = $class->getManagerReferenceGenerator(); $ref = call_user_func(array($model, 'get' . ucfirst($managerName))); $pool->getManager($managerName)->flush($ref); $id = call_user_func(array($ref, 'get' . ucfirst($class->getIdentifierReference($managerName)->referenceField))); foreach ($class->getFieldManagerNames() as $managerName) { $this->saveSpecificModel($model, $managerName, $id); } } } }
/** * Get session by session ID * * @param int $sessionId * @return \Thruway\Session|boolean */ public function getSessionBySessionId($sessionId) { /** @var Session $session */ $this->sessions->rewind(); while ($this->sessions->valid()) { $session = $this->sessions->getInfo(); if ($session->getSessionId() == $sessionId) { return $session; } $this->sessions->next(); } return false; }
public function saveDirtyModels() { $this->_dirtyModels->rewind(); while ($this->_dirtyModels->valid()) { /* @var $model \yii\db\ActiveRecord */ $model = $this->_dirtyModels->current(); $model->save(); $this->_dirtyModels->next(); } // SplObjectStorage doesn't have a clear() method?! $this->_dirtyModels = new \SplObjectStorage(); $this->_dirtyModelsInfo = []; }
/** * @param Session $session */ public function leave(Session $session) { $this->registrations->rewind(); while ($this->registrations->valid()) { /* @var $registration Registration */ $registration = $this->registrations->current(); $this->registrations->next(); if ($registration->getSession() == $session) { $this->manager->debug("Leaving and unegistering: {$registration->getProcedureName()}"); $this->registrations->detach($registration); } } }
/** * Performs the pipeline of callbacks to initial data. * It is possible to set an starting value, and to specify if that starting value has to be * casted (only has effect if a caster is set). * * @param mixed $initial * @param \Toobo\PipePie\DTO $dto * @param mixed $cursor * @return mixed */ public function applyTo($initial, DTO $dto = null, $cursor = null) { if ($this->working) { throw new LogicException("It is not possible run a Pipeline that is already working."); } if ($this->pipeline->count() === 0) { return $initial; } $this->DTOs->push($this->init($dto, $initial)); $carry = $this->initialValue($initial, $cursor); while ($this->pipeline->valid()) { $carry = $this->run($initial, $carry); $this->pipeline->next(); } $this->working = false; return $carry; }
/** * //@todo make this better * @param Session $session */ public function leave(Session $session) { $this->subscriptions->rewind(); while ($this->subscriptions->valid()) { /* @var $subscription Subscription */ $subscription = $this->subscriptions->current(); $this->subscriptions->next(); if ($subscription->getSession() == $session) { $this->manager->debug("Leaving and unsubscribing: {$subscription->getTopic()}"); $this->subscriptions->detach($subscription); } } foreach ($this->topics as $topicName => $subscribers) { foreach ($subscribers as $key => $subscriber) { if ($session == $subscriber) { unset($subscribers[$key]); $this->manager->debug("Removing session from topic list: {$topicName}"); } } } }
public function next() { $this->initialize(); parent::next(); }
/** * Move forward to next element * * @link http://php.net/manual/en/iterator.next.php * @return void Any returned value is ignored. * @since 5.0.0 */ public function next() { $this->collection->next(); }
<?php // Test code from: http://www.php.net/manual/en/splobjectstorage.getinfo.php $s = new SplObjectStorage(); $o1 = new StdClass(); $o2 = new StdClass(); $s->attach($o1, "d1"); $s->attach($o2, "d2"); $s->rewind(); while ($s->valid()) { $index = $s->key(); $object = $s->current(); // similar to current($s) $data = $s->getInfo(); var_dump($object); var_dump($data); $s->next(); } // now mutate $o2 and ensure it sticks $s->attach($o2, "mutated"); var_dump($s[$o2]);
/** * @inheritdoc */ public function next() { $this->connections->next(); }
function next() { echo __METHOD__ . "()\n"; parent::next(); }
private function updateAce(\SplObjectStorage $aces, $ace) { $propertyChanges = $aces->offsetGet($ace); $sets = array(); if (isset($propertyChanges['aceOrder']) && $propertyChanges['aceOrder'][1] > $propertyChanges['aceOrder'][0] && $propertyChanges == $aces->offsetGet($ace)) { $aces->next(); if ($aces->valid()) { $this->updateAce($aces, $aces->current()); } } if (isset($propertyChanges['mask'])) { $sets[] = sprintf('mask = %d', $propertyChanges['mask'][1]); } if (isset($propertyChanges['strategy'])) { $sets[] = sprintf('granting_strategy = %s', $this->connection->quote($propertyChanges['strategy'])); } if (isset($propertyChanges['aceOrder'])) { $sets[] = sprintf('ace_order = %d', $propertyChanges['aceOrder'][1]); } if (isset($propertyChanges['auditSuccess'])) { $sets[] = sprintf('audit_success = %s', $this->connection->getDatabasePlatform()->convertBooleans($propertyChanges['auditSuccess'][1])); } if (isset($propertyChanges['auditFailure'])) { $sets[] = sprintf('audit_failure = %s', $this->connection->getDatabasePlatform()->convertBooleans($propertyChanges['auditFailure'][1])); } $this->connection->executeQuery($this->getUpdateAccessControlEntrySql($ace->getId(), $sets)); }
private function insert($breadcrumb, $position) { if ($position < 0) { $position += $this->breadcrumbs->count(); } else { // $position >= 1 $position--; } $breadcrumbs = new \SplObjectStorage(); $breadcrumbs->addAll($this->breadcrumbs); $this->breadcrumbs->removeAll($this->breadcrumbs); $breadcrumbs->rewind(); while ($breadcrumbs->valid()) { if (max(0, $position) == $breadcrumbs->key()) { $this->breadcrumbs->attach($breadcrumb); } $this->breadcrumbs->attach($breadcrumbs->current()); $breadcrumbs->next(); } }