diff options
| author | Greg <supahgreg@users.noreply.github.com> | 2025-10-10 20:46:43 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-10 20:46:43 -0500 |
| commit | 46e0d6e1efa04c8905b4f8d016512125464a5732 (patch) | |
| tree | ec1df81a86310e44b5ef07fb4a9aebcb15186e77 /vendor/sebastian/code-unit/src/CodeUnitCollection.php | |
| parent | 92493059da37b3cbd7040f786b1129571e3893cc (diff) | |
| parent | 2d880e6c7dbdcabe87e9fbfc98835cc3b53eadd9 (diff) | |
Merge pull request #22 from tt-rss/bugfix/php-deps
Don't bundle PHP dev dependencies
Diffstat (limited to 'vendor/sebastian/code-unit/src/CodeUnitCollection.php')
| -rw-r--r-- | vendor/sebastian/code-unit/src/CodeUnitCollection.php | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/vendor/sebastian/code-unit/src/CodeUnitCollection.php b/vendor/sebastian/code-unit/src/CodeUnitCollection.php deleted file mode 100644 index f53db8a12..000000000 --- a/vendor/sebastian/code-unit/src/CodeUnitCollection.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php declare(strict_types=1); -/* - * This file is part of sebastian/code-unit. - * - * (c) Sebastian Bergmann <sebastian@phpunit.de> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace SebastianBergmann\CodeUnit; - -use function array_merge; -use function count; -use Countable; -use IteratorAggregate; - -final class CodeUnitCollection implements Countable, IteratorAggregate -{ - /** - * @psalm-var list<CodeUnit> - */ - private $codeUnits = []; - - /** - * @psalm-param list<CodeUnit> $items - */ - public static function fromArray(array $items): self - { - $collection = new self; - - foreach ($items as $item) { - $collection->add($item); - } - - return $collection; - } - - public static function fromList(CodeUnit ...$items): self - { - return self::fromArray($items); - } - - private function __construct() - { - } - - /** - * @psalm-return list<CodeUnit> - */ - public function asArray(): array - { - return $this->codeUnits; - } - - public function getIterator(): CodeUnitCollectionIterator - { - return new CodeUnitCollectionIterator($this); - } - - public function count(): int - { - return count($this->codeUnits); - } - - public function isEmpty(): bool - { - return empty($this->codeUnits); - } - - public function mergeWith(self $other): self - { - return self::fromArray( - array_merge( - $this->asArray(), - $other->asArray() - ) - ); - } - - private function add(CodeUnit $item): void - { - $this->codeUnits[] = $item; - } -} |