CyclicException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 5
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A cycleDetected() 0 7 1
1
<?php
2
3
namespace Potievdev\SlimRbac\Exception;
4
5
/**
6
 * This throws when cyclic line detected in roles hierarchy
7
 * Class CyclicException
8
 * @package Potievdev\SlimRbac\Exception
9
 */
10
class CyclicException extends BaseException
11
{
12
    public const MESSAGE = 'Cyclic role three detected';
13
14
    public static function cycleDetected(int $parentId, int $childId): self
15
    {
16
        $e = new self(self::MESSAGE);
17
18
        $e->additionalParams = ['parentId' => $parentId, 'childId' => $childId];
19
20
        return $e;
21
    }
22
}
23