Gzip::flow()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 8
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
/**
3
 * This file is part of graze/data-flow
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/data-flow/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/data-flow
12
 */
13
14
namespace Graze\DataFlow\Flow\File\Compression;
15
16
use Graze\DataFile\Node\LocalFile;
17
use Graze\DataFlow\Flow\InvokeTrait;
18
use Graze\DataFlow\FlowInterface;
19
use Graze\DataNode\NodeInterface;
20
use InvalidArgumentException;
21
22 View Code Duplication
class Gzip extends \Graze\DataFile\Modify\Compress\Gzip implements FlowInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
{
24
    use InvokeTrait;
25
26
    /**
27
     * Gzip constructor.
28
     *
29
     * @param array $options
30
     */
31 5
    public function __construct(array $options = [])
32
    {
33 5
        $this->options = $options;
34 5
    }
35
36
    /**
37
     * Run a 'flow' through the handler
38
     *
39
     * @param NodeInterface $node
40
     *
41
     * @return LocalFile
42
     */
43 4
    public function flow(NodeInterface $node)
44
    {
45 4
        if (!($node instanceof LocalFile)) {
46 1
            throw new InvalidArgumentException("Node: $node should be an instance of LocalFile");
47
        }
48
49 3
        return $this->compress($node, $this->options);
50
    }
51
}
52