BiblePassageCollection   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A offsetGet() 0 3 1
A offsetUnset() 0 3 1
A offsetExists() 0 3 1
A offsetSet() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TechWilk\BibleVerseParser;
6
7
use ArrayAccess;
8
use BadMethodCallException;
9
10
class BiblePassageCollection implements ArrayAccess
11
{
12
    protected $passages = [];
13
14
    public function __construct(BiblePassage ...$passages)
15
    {
16
        $this->passages = $passages;
17
    }
18
19
    public function offsetExists($key): bool
20
    {
21
        return array_key_exists($key, $this->passages);
22
    }
23
24
    public function offsetGet($key): BiblePassage
25
    {
26
        return $this->passages[$key];
27
    }
28
29
    public function offsetSet($key, $value): void
30
    {
31
        throw new BadMethodCallException('Bible Passage Collections are immutable');
32
    }
33
34
    public function offsetUnset($key)
35
    {
36
        throw new BadMethodCallException('Bible Passage Collections are immutable');
37
    }
38
}
39