Completed
Pull Request — master (#7)
by Sandro
02:42
created

UnreadableStreamException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 5
dl 0
loc 20
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A dueToPhpError() 0 3 1
A forCallbackStream() 0 3 1
A dueToConfiguration() 0 3 1
A dueToMissingResource() 0 3 1
1
<?php
2
/**
3
 * Sandro Keil (https://sandro-keil.de)
4
 *
5
 * @link      http://github.com/sandrokeil/arangodb-php-client for the canonical source repository
6
 * @copyright Copyright (c) 2018-2019 Sandro Keil
7
 * @license   http://github.com/sandrokeil/arangodb-php-client/blob/master/LICENSE.md New BSD License
8
 */
9
10
declare(strict_types=1);
11
12
namespace ArangoDb\Exception;
13
14
/**
15
 * Code is largely lifted from the Zend\Diactoros\Stream implementation in
16
 * Zend Diactoros, released with the copyright and license below.
17
 *
18
 * @see       https://github.com/zendframework/zend-diactoros for the canonical source repository
19
 * @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com)
20
 * @license   https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
21
 */
22
class UnreadableStreamException extends RuntimeException
23
{
24
    public static function dueToConfiguration() : self
25
    {
26
        return new self('Stream is not readable');
27
    }
28
29
    public static function dueToMissingResource() : self
30
    {
31
        return new self('No resource available; cannot read');
32
    }
33
34
    public static function dueToPhpError() : self
35
    {
36
        return new self('Error reading stream');
37
    }
38
39
    public static function forCallbackStream() : self
40
    {
41
        return new self('Callback streams cannot read');
42
    }
43
}
44