Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of PHPUnit.
4
 *
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PHPUnit\TextUI\XmlConfiguration;
11
 
12
use IteratorAggregate;
13
 
14
/**
15
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
16
 *
17
 * @psalm-immutable
18
 *
19
 * @template-implements IteratorAggregate<int, Extension>
20
 */
21
final class ExtensionCollection implements IteratorAggregate
22
{
23
    /**
24
     * @var Extension[]
25
     */
26
    private $extensions;
27
 
28
    /**
29
     * @param Extension[] $extensions
30
     */
31
    public static function fromArray(array $extensions): self
32
    {
33
        return new self(...$extensions);
34
    }
35
 
36
    private function __construct(Extension ...$extensions)
37
    {
38
        $this->extensions = $extensions;
39
    }
40
 
41
    /**
42
     * @return Extension[]
43
     */
44
    public function asArray(): array
45
    {
46
        return $this->extensions;
47
    }
48
 
49
    public function getIterator(): ExtensionCollectionIterator
50
    {
51
        return new ExtensionCollectionIterator($this);
52
    }
53
}