Completed
Push — master ( c97103...9edfc5 )
by Evgenij
03:08
created

BadResourceException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A notSocketResource() 0 6 1
A canNotObtainLocalAddress() 0 4 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
11
namespace AsyncSockets\Exception;
12
13
/**
14
 * Class BadResourceException
15
 */
16
class BadResourceException extends \InvalidArgumentException
17
{
18
    /**
19
     * Create error for incorrect resource
20
     *
21
     * @param string $type Resource type
22
     *
23
     * @return BadResourceException
24
     */
25
    public static function notSocketResource($type)
26
    {
27
        return new self(
28
            sprintf('Can not create socket from resource "%s"', $type)
29
        );
30
    }
31
32
    /**
33
     * Can not get local socket address
34
     *
35
     * @return BadResourceException
36
     */
37
    public static function canNotObtainLocalAddress()
38
    {
39
        return new self('Can not retrieve local socket address.');
40
    }
41
}
42