BiblePassage   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 13
c 1
b 0
f 0
dl 0
loc 35
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A chapterRange() 0 3 1
A verseRange() 0 3 1
A __toString() 0 7 2
A book() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TechWilk\BibleVerseParser;
6
7
class BiblePassage
8
{
9
    protected $book;
10
    protected $chapter;
11
    protected $verse;
12
13
    public function __construct(string $book, string $chapterRange, string $verseRange)
14
    {
15
        $this->book = trim($book);
16
        $this->chapter = trim($chapterRange);
17
        $this->verse = trim($verseRange);
18
    }
19
20
    public function book(): string
21
    {
22
        return $this->book;
23
    }
24
25
    public function chapterRange(): string
26
    {
27
        return $this->chapter;
28
    }
29
30
    public function verseRange(): string
31
    {
32
        return $this->verse;
33
    }
34
35
    public function __toString(): string
36
    {
37
        if ('' === $this->verse) {
38
            return "{$this->book} {$this->chapter}";
39
        }
40
41
        return "{$this->book} {$this->chapter}:{$this->verse}";
42
    }
43
}
44