Completed
Branch 0.4-dev (d27253)
by Evgenij
03:26
created

SendDataException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 26
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A failedToSendData() 0 4 1
A __construct() 0 8 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
class SendDataException extends TransferException
18
{
19
    /**
20
     * Creates data sending failure
21
     *
22
     * @param SocketInterface $socket Socket with error
23
     *
24
     * @return SendDataException
25
     */
26 6
    public static function failedToSendData(SocketInterface $socket)
27
    {
28 6
        return new self($socket, 'Failed to send data.');
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34 9
    public function __construct(
35
        SocketInterface $socket,
36
        $message = '',
37
        $code = 0,
38
        \Exception $previous = null
39
    ) {
40 9
        parent::__construct($socket, self::DIRECTION_SEND, $message, $code, $previous);
41 9
    }
42
}
43