Actualización

This commit is contained in:
Xes
2025-04-10 12:24:57 +02:00
parent 8969cc929d
commit 45420b6f0d
39760 changed files with 4303286 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
<?php
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\Exporter\Source;
use ArrayIterator;
class ChainSourceIterator implements SourceIteratorInterface
{
/**
* @var ArrayIterator
*/
protected $sources;
/**
* @param array $sources
*/
public function __construct(array $sources = [])
{
$this->sources = new ArrayIterator();
foreach ($sources as $source) {
$this->addSource($source);
}
}
/**
* @param SourceIteratorInterface $source
*/
public function addSource(SourceIteratorInterface $source)
{
$this->sources->append($source);
}
/**
* {@inheritdoc}
*/
public function current()
{
return $this->sources->current()->current();
}
/**
* {@inheritdoc}
*/
public function next()
{
$this->sources->current()->next();
}
/**
* {@inheritdoc}
*/
public function key()
{
return $this->sources->current()->key();
}
/**
* {@inheritdoc}
*/
public function valid()
{
while (!$this->sources->current()->valid()) {
$this->sources->next();
if (!$this->sources->valid()) {
return false;
}
$this->sources->current()->rewind();
}
return true;
}
/**
* {@inheritdoc}
*/
public function rewind()
{
if ($this->sources->current()) {
$this->sources->current()->rewind();
}
}
}
class_exists(\Exporter\Source\ChainSourceIterator::class);