BiblePassage::__toString()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 7
rs 10
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