LegacyGuzzleTeleporter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 27
loc 27
rs 10
c 0
b 0
f 0

2 Methods

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

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
/*
4
 * This file is part of Zippy.
5
 *
6
 * (c) Alchemy <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Alchemy\Zippy\Resource\Teleporter;
13
14
use Alchemy\Zippy\Resource\Reader\Guzzle\LegacyGuzzleReaderFactory;
15
use Alchemy\Zippy\Resource\ResourceLocator;
16
use Alchemy\Zippy\Resource\ResourceReaderFactory;
17
use Alchemy\Zippy\Resource\Writer\FilesystemWriter;
18
use Guzzle\Http\Client;
19
20
/**
21
 * Guzzle Teleporter implementation for HTTP resources
22
 *
23
 * @deprecated Use \Alchemy\Zippy\Resource\GenericTeleporter instead. This class will be removed in v0.5.x
24
 */
25 View Code Duplication
class LegacyGuzzleTeleporter extends GenericTeleporter
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...
26
{
27
    /**
28
     * @param Client $client
29
     * @param ResourceReaderFactory $readerFactory
30
     * @param ResourceLocator $resourceLocator
31
     */
32
    public function __construct(
33
        Client $client = null,
34
        ResourceReaderFactory $readerFactory = null,
35
        ResourceLocator $resourceLocator = null
36
    ) {
37
        parent::__construct($readerFactory ?: new LegacyGuzzleReaderFactory($client), new FilesystemWriter(),
38
            $resourceLocator);
39
    }
40
41
    /**
42
     * Creates the GuzzleTeleporter
43
     *
44
     * @deprecated
45
     * @return LegacyGuzzleTeleporter
46
     */
47
    public static function create()
48
    {
49
        return new static();
0 ignored issues
show
Deprecated Code introduced by
The class Alchemy\Zippy\Resource\T...\LegacyGuzzleTeleporter has been deprecated with message: Use \Alchemy\Zippy\Resource\GenericTeleporter instead. This class will be removed in v0.5.x

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
50
    }
51
}
52