Completed
Push — master ( 95ea2a...2fea48 )
by Evgenij
02:43
created

FrameException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 1
dl 39
loc 39
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 10 10 1
A getFramePicker() 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
 * Async sockets
4
 *
5
 * @copyright Copyright (c) 2015-2016, Efimov Evgenij <[email protected]>
6
 *
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
namespace AsyncSockets\Exception;
11
12
use AsyncSockets\Frame\FramePickerInterface;
13
use AsyncSockets\Socket\SocketInterface;
14
15
/**
16
 * Class FrameException
17
 */
18 View Code Duplication
class FrameException extends NetworkSocketException
1 ignored issue
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...
19
{
20
    /**
21
     * Failed FramePicker
22
     *
23
     * @var FramePickerInterface
24
     */
25
    private $picker;
26
27
    /**
28
     * Construct the exception.
29
     *
30
     * @param FramePickerInterface  $picker Corrupted framePicker
31
     * @param SocketInterface $socket Socket object
32
     * @param string          $message The Exception message to throw.
33
     * @param int             $code The Exception code.
34
     * @param \Exception      $previous The previous exception used for the exception chaining.
35
     */
36 7
    public function __construct(
37
        FramePickerInterface $picker,
38
        SocketInterface $socket,
39
        $message = '',
40
        $code = 0,
41
        \Exception $previous = null
42
    ) {
43 7
        parent::__construct($socket, $message, $code, $previous);
44 7
        $this->picker = $picker;
45 7
    }
46
47
    /**
48
     * Return corrupted framePicker
49
     *
50
     * @return FramePickerInterface
51
     */
52 1
    public function getFramePicker()
53
    {
54 1
        return $this->picker;
55
    }
56
}
57