Completed
Push — 3.x ( e32815...7c4255 )
by Ryota
10:41 queued 09:27
created

Tasks   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 36
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A show() 6 6 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
declare(strict_types=1);
4
5
namespace Polidog\Chatwork\Api\My;
6
7
use Polidog\Chatwork\Client\ClientInterface;
8
use Polidog\Chatwork\Entity\Collection\CollectionInterface;
9
use Polidog\Chatwork\Entity\Factory\TaskFactory;
10
11 View Code Duplication
class Tasks
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...
12
{
13
    /**
14
     * @var ClientInterface
15
     */
16
    private $client;
17
18
    /**
19
     * @var TaskFactory
20
     */
21
    private $factory;
22
23
    /**
24
     * Tasks constructor.
25
     *
26
     * @param ClientInterface $client
27
     * @param TaskFactory     $factory
28
     */
29
    public function __construct(ClientInterface $client, TaskFactory $factory)
30
    {
31
        $this->client = $client;
32
        $this->factory = $factory;
33
    }
34
35
    /**
36
     * @param array $options
37
     *
38
     * @return CollectionInterface
39
     */
40
    public function show(array $options = [])
41
    {
42
        return $this->factory->collection(
43
            $this->client->get('my/tasks', $options)
44
        );
45
    }
46
}
47