Code Duplication    Length = 14-16 lines in 2 locations

src/SpriteProcessor/AbstractSpriteProcessor.php 1 location

@@ 55-70 (lines=16) @@
52
        return $this;
53
    }
54
55
    public function save()
56
    {
57
        if (empty($this->filepath)) {
58
            throw new \Exception('No file path set on the Processor');
59
        }
60
61
        if ($this->overwrite === false && file_exists($this->filepath)) {
62
            throw new \Exception('File "'.$this->filepath.'" already exists and overwriting is disabled in the Processor');
63
        }
64
65
        if (file_exists($this->filepath)) {
66
            unlink($this->filepath);
67
        }
68
69
        return $this->image->save($this->filepath);
70
    }
71
}
72

src/Generator/AbstractGenerator.php 1 location

@@ 48-61 (lines=14) @@
45
        return $this;
46
    }
47
48
    public function save()
49
    {
50
        if (empty($this->filepath)) {
51
            throw new \Exception('No file path set on the Generator');
52
        }
53
54
        if ($this->overwrite === false && file_exists($this->filepath)) {
55
            throw new \Exception('File "'.$this->filepath.'" already exists and overwriting is disabled in the Processor');
56
        }
57
58
        $this->process();
59
60
        return file_put_contents($this->filepath, $this->content);
61
    }
62
}
63