DuplicateAssetMappingException::forUuid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 7
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
3
/*
4
 * This file is part of the puli/manager 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\Manager\Api\Asset;
13
14
use Exception;
15
use Rhumsaa\Uuid\Uuid;
16
17
/**
18
 * Thrown when an asset mapping exists already.
19
 *
20
 * @since  1.0
21
 *
22
 * @author Bernhard Schussek <[email protected]>
23
 */
24 View Code Duplication
class DuplicateAssetMappingException extends Exception
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
{
26
    /**
27
     * Creates an exception for a UUID that exists already.
28
     *
29
     * @param Uuid           $uuid  The UUID of the mapping.
30
     * @param Exception|null $cause The exception that caused this exception.
31
     *
32
     * @return static The created exception.
33
     */
34 1
    public static function forUuid(Uuid $uuid, Exception $cause = null)
35
    {
36 1
        return new static(sprintf(
37 1
            'The asset mapping "%s" exists already.',
38 1
            $uuid->toString()
39 1
        ), 0, $cause);
40
    }
41
}
42