SheetNotFoundException::make()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 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 6
    public static function make(string $collection, string $path): self
19
    {
20 6
        return (new static("Sheet [{$path}] in collection [{$collection}] does not exist."))->setCollection($collection)->setSheet($path);
21
    }
22
23 5
    public function getCollection(): string
24
    {
25 5
        return $this->collection;
26
    }
27
28 6
    public function setCollection(string $collection): self
29
    {
30 6
        $this->collection = $collection;
31
32 6
        return $this;
33
    }
34
35 5
    public function getSheet(): string
36
    {
37 5
        return $this->sheet;
38
    }
39
40 6
    public function setSheet(string $sheet): self
41
    {
42 6
        $this->sheet = $sheet;
43
44 6
        return $this;
45
    }
46
47 4
    public function getSolution(): Solution
48
    {
49 4
        return new AddSheetToCollectionSolution($this->getCollection(), $this->getSheet());
50
    }
51
}
52