Passed
Pull Request — master (#7)
by Sandro
03:17
created

UntellableStreamException::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 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
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 UntellableStreamException extends RuntimeException
23
{
24
    public static function dueToMissingResource() : self
25
    {
26
        return new self('No resource available; cannot tell position');
27
    }
28
29
    public static function dueToPhpError() : self
30
    {
31
        return new self('Error occurred during tell operation');
32
    }
33
34
    public static function forCallbackStream() : self
35
    {
36
        return new self('Callback streams cannot tell position');
37
    }
38
}
39