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

SendDataException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 4
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
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