Completed
Branch 0.4-dev (25e57a)
by Evgenij
02:18
created

SendDataException::failedToSendData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Async sockets
4
 *
5
 * @copyright Copyright (c) 2015-2017, 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\Socket\SocketInterface;
13
14
/**
15
 * Class SendDataException. Thrown any time there is a problem with sending data to remote side
16
 */
17 View Code Duplication
class SendDataException extends TransferException
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...
18
{
19
    /**
20
     * Creates data sending failure
21
     *
22 8
     * @param SocketInterface $socket Socket with error
23
     *
24
     * @return SendDataException
25
     */
26
    public static function failedToSendData(SocketInterface $socket)
27
    {
28 8
        return new self($socket, 'Failed to send data.');
29 8
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34
    public function __construct(
35
        SocketInterface $socket,
36
        $message = '',
37
        $code = 0,
38
        \Exception $previous = null
39
    ) {
40
        parent::__construct($socket, self::DIRECTION_SEND, $message, $code, $previous);
41
    }
42
}
43