Passed
Pull Request — master (#7)
by Sandro
02:06
created

UnreadableStreamException::dueToMissingResource()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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