Passed
Push — master ( 7e6483...d784e3 )
by Michael
02:46
created

AttributeOverrideException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 6
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Mikemirten\Component\JsonApi\Exception;
5
6
use Mikemirten\Component\JsonApi\Document\ResourceObject;
7
8
/**
9
 * AttributeOverrideException
10
 *
11
 * @package Mikemirten\Component\JsonApi\Exception
12
 */
13 View Code Duplication
class AttributeOverrideException extends JsonApiException
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...
14
{
15
    /**
16
     * AttributeOverrideException constructor.
17
     *
18
     * @param ResourceObject  $resource
19
     * @param string          $name
20
     * @param \Exception|null $previous
21
     */
22 1
    public function __construct(ResourceObject $resource, string $name, \Exception $previous = null)
23
    {
24 1
        $message = sprintf('Attribute "%s" already exists inside of [%s]. To set new one, the old one must be removed.', $name, $resource);
25
26 1
        parent::__construct($message, 0, $previous);
27
    }
28
}