Code Duplication    Length = 30-30 lines in 4 locations

src/Flow/File/Compression/Gunzip.php 1 location

@@ 22-51 (lines=30) @@
19
use Graze\DataNode\NodeInterface;
20
use InvalidArgumentException;
21
22
class Gunzip extends \Graze\DataFile\Modify\Compress\Gzip implements FlowInterface
23
{
24
    use InvokeTrait;
25
26
    /**
27
     * Gzip constructor.
28
     *
29
     * @param array $options
30
     */
31
    public function __construct(array $options = [])
32
    {
33
        $this->options = $options;
34
    }
35
36
    /**
37
     * Run a 'flow' through the handler
38
     *
39
     * @param NodeInterface $node
40
     *
41
     * @return LocalFile
42
     */
43
    public function flow(NodeInterface $node)
44
    {
45
        if (!($node instanceof LocalFile)) {
46
            throw new InvalidArgumentException("Node: $node should be an instance of LocalFile");
47
        }
48
49
        return $this->decompress($node, $this->options);
50
    }
51
}
52

src/Flow/File/Compression/Gzip.php 1 location

@@ 22-51 (lines=30) @@
19
use Graze\DataNode\NodeInterface;
20
use InvalidArgumentException;
21
22
class Gzip extends \Graze\DataFile\Modify\Compress\Gzip implements FlowInterface
23
{
24
    use InvokeTrait;
25
26
    /**
27
     * Gzip constructor.
28
     *
29
     * @param array $options
30
     */
31
    public function __construct(array $options = [])
32
    {
33
        $this->options = $options;
34
    }
35
36
    /**
37
     * Run a 'flow' through the handler
38
     *
39
     * @param NodeInterface $node
40
     *
41
     * @return LocalFile
42
     */
43
    public function flow(NodeInterface $node)
44
    {
45
        if (!($node instanceof LocalFile)) {
46
            throw new InvalidArgumentException("Node: $node should be an instance of LocalFile");
47
        }
48
49
        return $this->compress($node, $this->options);
50
    }
51
}
52

src/Flow/File/Compression/Unzip.php 1 location

@@ 22-51 (lines=30) @@
19
use Graze\DataNode\NodeInterface;
20
use InvalidArgumentException;
21
22
class Unzip extends \Graze\DataFile\Modify\Compress\Zip implements FlowInterface
23
{
24
    use InvokeTrait;
25
26
    /**
27
     * Gzip constructor.
28
     *
29
     * @param array $options
30
     */
31
    public function __construct(array $options = [])
32
    {
33
        $this->options = $options;
34
    }
35
36
    /**
37
     * Run a 'flow' through the handler
38
     *
39
     * @param NodeInterface $node
40
     *
41
     * @return LocalFile
42
     */
43
    public function flow(NodeInterface $node)
44
    {
45
        if (!($node instanceof LocalFile)) {
46
            throw new InvalidArgumentException("Node: $node should be an instance of LocalFile");
47
        }
48
49
        return $this->decompress($node, $this->options);
50
    }
51
}
52

src/Flow/File/Compression/Zip.php 1 location

@@ 22-51 (lines=30) @@
19
use Graze\DataNode\NodeInterface;
20
use InvalidArgumentException;
21
22
class Zip extends \Graze\DataFile\Modify\Compress\Zip implements FlowInterface
23
{
24
    use InvokeTrait;
25
26
    /**
27
     * Gzip constructor.
28
     *
29
     * @param array $options
30
     */
31
    public function __construct(array $options = [])
32
    {
33
        $this->options = $options;
34
    }
35
36
    /**
37
     * Run a 'flow' through the handler
38
     *
39
     * @param NodeInterface $node
40
     *
41
     * @return LocalFile
42
     */
43
    public function flow(NodeInterface $node)
44
    {
45
        if (!($node instanceof LocalFile)) {
46
            throw new InvalidArgumentException("Node: $node should be an instance of LocalFile");
47
        }
48
49
        return $this->compress($node, $this->options);
50
    }
51
}
52