Completed
Branch master (1d1574)
by Evgenij
18:38
created

UnmanagedSocketException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A zombieSocketDetected() 0 12 1
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\Socket\SocketInterface;
13
14
/**
15
 * Class UnmanagedSocketException. Throws when system detects some unexpected conditions and suppose
16
 * that operation couldn't be completed
17
 */
18
class UnmanagedSocketException extends NetworkSocketException
19
{
20
    /**
21
     * Socket data will not be correctly processed by application.
22
     *
23
     * @param SocketInterface $socket Socket object caused exception
24
     *
25
     * @return UnmanagedSocketException
26
     */
27 2
    public static function zombieSocketDetected(SocketInterface $socket)
28
    {
29 2
        return new self(
30 2
            $socket,
31 2
            sprintf(
32
                'System has detected a zombie connection %s and closed it. '.
33 2
                'If you see this message it means that application ' .
34 2
                'has lost control on one of its sockets.',
35
                (string) $socket
36 2
            )
37 2
        );
38
    }
39
}
40