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 function count;
13
use Countable;
14
use IteratorAggregate;
15
 
16
/**
17
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
18
 *
19
 * @psalm-immutable
20
 *
21
 * @template-implements IteratorAggregate<int, IniSetting>
22
 */
23
final class IniSettingCollection implements Countable, IteratorAggregate
24
{
25
    /**
26
     * @var IniSetting[]
27
     */
28
    private $iniSettings;
29
 
30
    /**
31
     * @param IniSetting[] $iniSettings
32
     */
33
    public static function fromArray(array $iniSettings): self
34
    {
35
        return new self(...$iniSettings);
36
    }
37
 
38
    private function __construct(IniSetting ...$iniSettings)
39
    {
40
        $this->iniSettings = $iniSettings;
41
    }
42
 
43
    /**
44
     * @return IniSetting[]
45
     */
46
    public function asArray(): array
47
    {
48
        return $this->iniSettings;
49
    }
50
 
51
    public function count(): int
52
    {
53
        return count($this->iniSettings);
54
    }
55
 
56
    public function getIterator(): IniSettingCollectionIterator
57
    {
58
        return new IniSettingCollectionIterator($this);
59
    }
60
}