0 follower

Final Class Yiisoft\HttpMiddleware\TagRequest\TagProvider\PredefinedTagProvider

InheritanceYiisoft\HttpMiddleware\TagRequest\TagProvider\PredefinedTagProvider
ImplementsYiisoft\HttpMiddleware\TagRequest\TagProvider\TagProviderInterface

Provides tags from a predefined collection. Useful for testing purposes.

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( iterable $tags )
$tags iterable

Predefined tags to be returned by the provider.

                public function __construct(iterable $tags)
{
    $this->iterator = $this->createIterator($tags);
}

            
get() public method

public string get ( )

                public function get(): string
{
    if (!$this->iterator->valid()) {
        throw new OutOfBoundsException('No more tags available.');
    }
    /** @var string $tag */
    $tag = $this->iterator->current();
    $this->iterator->next();
    return $tag;
}