AttributeOverrideException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Mikemirten\Component\JsonApi\Document\Exception;
5
6
use Mikemirten\Component\JsonApi\Document\ResourceObject;
7
8
/**
9
 * AttributeOverrideException
10
 *
11
 * @package Mikemirten\Component\JsonApi\Exception
12
 */
13
class AttributeOverrideException extends DocumentException
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
}