Code Duplication    Length = 14-14 lines in 2 locations

src/Spreadsheet.php 2 locations

@@ 39-52 (lines=14) @@
36
        return $this->sheets;
37
    }
38
39
    public function add(SheetInterface $sheet): SpreadsheetInterface
40
    {
41
        if ($this->has($sheet->name())) {
42
            throw new SheetAlreadyExistsException;
43
        }
44
45
        $self = new self($this->name);
46
        $self->sheets = $this->sheets->put(
47
            $sheet->name(),
48
            $sheet
49
        );
50
51
        return $self;
52
    }
53
54
    public function replace(SheetInterface $sheet): SpreadsheetInterface
55
    {
@@ 54-67 (lines=14) @@
51
        return $self;
52
    }
53
54
    public function replace(SheetInterface $sheet): SpreadsheetInterface
55
    {
56
        if (!$this->has($sheet->name())) {
57
            throw new SheetNotFoundException;
58
        }
59
60
        $self = new self($this->name);
61
        $self->sheets = $this->sheets->put(
62
            $sheet->name(),
63
            $sheet
64
        );
65
66
        return $self;
67
    }
68
69
    public function has(string $sheet): bool
70
    {