本文整理汇总了PHP中SplObjectStorage::rewind方法的典型用法代码示例。如果您正苦于以下问题:PHP SplObjectStorage::rewind方法的具体用法?PHP SplObjectStorage::rewind怎么用?PHP SplObjectStorage::rewind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplObjectStorage
的用法示例。
在下文中一共展示了SplObjectStorage::rewind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init(array $filters = array())
{
foreach ($filters as $filter) {
$this->addFilter($filter);
}
$this->_filters->rewind();
}
示例2: onEventProcessingFailed
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();
}
}
示例3: registerImageSizes
/**
*
* 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();
}
}
示例4: hookUp
/**
* 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();
}
}
示例5: refreshQueue
/**
* 刷新监听者队列
*/
protected function refreshQueue()
{
$this->storage->rewind();
$this->queue = new \SplPriorityQueue();
foreach ($this->storage as $listener) {
$priority = $this->storage->getInfo();
$this->queue->insert($listener, $priority);
}
}
示例6: getTwig
/**
* 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;
}
示例7: getAllFiles
/**
* @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;
}
示例8: find
/**
* 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()));
}
示例9: registerTaxonomies
/**
* 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();
}
}
示例10: registerPostTypes
/**
* 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();
}
}
示例11: registerShortcodes
/**
* 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();
}
}
示例12: addMetaBoxes
/**
* 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();
}
}
示例13: registerFieldGroups
/**
* 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();
}
}
示例14: getConnectionByPosition
/**
* @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;
}
示例15: getNumberOfAdvancedCourses
/**
* @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;
}