Zip   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 3
c 4
b 0
f 0
lcom 1
cbo 2
dl 30
loc 30
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A flow() 8 8 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 Zip extends \Graze\DataFile\Modify\Compress\Zip 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 4
    public function __construct(array $options = [])
32
    {
33 4
        $this->options = $options;
34 4
    }
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