Update website
This commit is contained in:
parent
4413528994
commit
1d90fbf296
6865 changed files with 1091082 additions and 0 deletions
58
vendor/doctrine/rst-parser/lib/Parser/Lines.php
vendored
Normal file
58
vendor/doctrine/rst-parser/lib/Parser/Lines.php
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\RST\Parser;
|
||||
|
||||
use Iterator;
|
||||
|
||||
/** @template-implements Iterator<array-key, string> */
|
||||
final class Lines implements Iterator
|
||||
{
|
||||
/** @var string[] */
|
||||
private $lines = [];
|
||||
|
||||
/** @var int */
|
||||
private $position = 0;
|
||||
|
||||
/** @param string[] $lines */
|
||||
public function __construct(array $lines)
|
||||
{
|
||||
$this->lines = $lines;
|
||||
}
|
||||
|
||||
public function getPreviousLine(): string
|
||||
{
|
||||
return $this->lines[$this->position - 1] ?? '';
|
||||
}
|
||||
|
||||
public function getNextLine(): string
|
||||
{
|
||||
return $this->lines[$this->position + 1] ?? '';
|
||||
}
|
||||
|
||||
public function rewind(): void
|
||||
{
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
public function current(): string
|
||||
{
|
||||
return $this->lines[$this->position];
|
||||
}
|
||||
|
||||
public function key(): int
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function next(): void
|
||||
{
|
||||
++$this->position;
|
||||
}
|
||||
|
||||
public function valid(): bool
|
||||
{
|
||||
return isset($this->lines[$this->position]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue