Failed Conditions
Push — 1.0 ( 9f5a0b...fe7a2f )
by Bernhard
30:36 queued 17:00
created

NoVersionFoundException::forPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4286
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
3
/*
4
 * This file is part of the vendor/project 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 Puli\Repository\Api;
13
14
use Exception;
15
16
/**
17
 * Thrown when a change stream contains no version of a resource.
18
 *
19
 * @since  1.0
20
 *
21
 * @author Bernhard Schussek <[email protected]>
22
 */
23
class NoVersionFoundException extends ResourceNotFoundException
24
{
25
    /**
26
     * Creates a new exception for a resource path.
27
     *
28
     * @param string         $path  The path which was not found.
29
     * @param Exception|null $cause The exception that caused this exception.
30
     *
31
     * @return static The created exception.
32
     */
33 41
    public static function forPath($path, Exception $cause = null)
34
    {
35 41
        return new static(sprintf(
36 41
            'Could not find any version of path %s.',
37
            $path
38 41
        ), 0, $cause);
39
    }
40
}
41