MinkParameters::count()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FriendsOfBehat\SymfonyExtension\Mink;
6
7
/** @final */
8
class MinkParameters implements \Countable, \IteratorAggregate, \ArrayAccess
9
{
10
    /** @var array */
11
    private $minkParameters;
12
13
    public function __construct(array $minkParameters)
14
    {
15
        $this->minkParameters = $minkParameters;
16
    }
17
18
    public function getIterator(): \Traversable
19
    {
20
        return new \ArrayIterator($this->minkParameters);
21
    }
22
23
    public function offsetExists($offset): bool
24
    {
25
        return array_key_exists($offset, $this->minkParameters);
26
    }
27
28
    public function offsetGet($offset)
29
    {
30
        return $this->minkParameters[$offset] ?? null;
31
    }
32
33
    public function offsetSet($offset, $value): void
34
    {
35
        throw new \BadMethodCallException(sprintf('"%s" is immutable.', self::class));
36
    }
37
38
    public function offsetUnset($offset): void
39
    {
40
        throw new \BadMethodCallException(sprintf('"%s" is immutable.', self::class));
41
    }
42
43
    public function count(): int
44
    {
45
        return count($this->minkParameters);
46
    }
47
}
48