ChannelHold   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 31
loc 31
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getChannel() 4 4 1
A getEventId() 4 4 1
A __construct() 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
 * Created by Piskle.
4
 * Date: 8/22/16
5
 * Time: 3:00 PM
6
 */
7
8
namespace phparia\Events;
9
10
use phparia\Client\AriClient;
11
use phparia\Resources\Channel;
12
13
14 View Code Duplication
class ChannelHold extends Event implements IdentifiableEventInterface
15
{
16
    /**
17
     * @var Channel
18
     */
19
    private $channel;
20
21
    /**
22
     * @return Channel
23
     */
24
    public function getChannel()
25
    {
26
        return $this->channel;
27
    }
28
29
    public function getEventId()
30
    {
31
        return "{$this->getType()}_{$this->getChannel()->getId()}";
32
    }
33
34
    /**
35
     * @param AriClient $client
36
     * @param string $response
37
     */
38
    public function __construct(AriClient $client, $response)
39
    {
40
        parent::__construct($client, $response);
41
42
        $this->channel = $this->getResponseValue('channel', 'phparia\Resources\Channel', $client);
43
    }
44
}