SheetNotFoundException   A
last analyzed

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 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