WriteException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A forException() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the webmozart/key-value-store package.
5
 *
6
 * (c) Bernhard Schussek <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Webmozart\KeyValueStore\Api;
13
14
use Exception;
15
use RuntimeException;
16
17
/**
18
 * Thrown when a key-value store cannot be written.
19
 *
20
 * @since  1.0
21
 *
22
 * @author Bernhard Schussek <[email protected]>
23
 */
24
class WriteException extends RuntimeException
25
{
26
    /**
27
     * Creates a new exception..
28
     *
29
     * @param Exception $exception The exception that caused this exception.
30
     *
31
     * @return static The new exception.
32
     */
33 31
    public static function forException(Exception $exception)
34
    {
35 31
        return new static(sprintf(
36 31
            'Could not write key-value store: %s',
37 31
            $exception->getMessage()
38 31
        ), $exception->getCode(), $exception);
39
    }
40
}
41