Completed
Push — master ( 6d4325...ab885c )
by Tom
04:09
created

SheetNotFoundException   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 6
eloc 11
c 1
b 0
f 1
dl 0
loc 40
ccs 14
cts 14
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A make() 0 3 1
A getCollection() 0 3 1
A getSheet() 0 3 1
A setCollection() 0 5 1
A setSheet() 0 5 1
A getSolution() 0 3 1
1
<?php
2
3
namespace Astrotomic\Stancy\Exceptions;
4
5
use Astrotomic\Stancy\Solutions\AddSheetToCollectionSolution;
6
use Facade\IgnitionContracts\ProvidesSolution;
7
use Facade\IgnitionContracts\Solution;
8
use RuntimeException;
9
10
class SheetNotFoundException extends RuntimeException implements ProvidesSolution
11
{
12
    /** @var string */
13
    protected $collection;
14
15
    /** @var string */
16
    protected $sheet;
17
18 5
    public static function make(string $collection, string $sheet): self
19
    {
20 5
        return (new static("Sheet [{$sheet}] in collection [{$collection}] does not exist."))->setCollection($collection)->setSheet($sheet);
21
    }
22
23 4
    public function getCollection(): string
24
    {
25 4
        return $this->collection;
26
    }
27
28 5
    public function setCollection(string $collection): self
0 ignored issues
show
introduced by
Setters are not allowed. Use constructor injection and behavior naming instead.
Loading history...
29
    {
30 5
        $this->collection = $collection;
31
32 5
        return $this;
33
    }
34
35 4
    public function getSheet(): string
36
    {
37 4
        return $this->sheet;
38
    }
39
40 5
    public function setSheet(string $sheet): self
0 ignored issues
show
introduced by
Setters are not allowed. Use constructor injection and behavior naming instead.
Loading history...
41
    {
42 5
        $this->sheet = $sheet;
43
44 5
        return $this;
45
    }
46
47 3
    public function getSolution(): Solution
48
    {
49 3
        return new AddSheetToCollectionSolution($this->getCollection(), $this->getSheet());
50
    }
51
}
52