InvalidAccess   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 12
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RulerZ\Exception;
6
7
use Hoa\Ruler\Model as AST;
8
9
class InvalidAccess extends \RuntimeException
10
{
11
    public static function create(AST\Bag\Context $element): self
12
    {
13
        $dimensionNames = array_map(function ($dimension) {
14
            return $dimension[1];
15
        }, $element->getDimensions());
16
        $dimensionNames = array_merge([$element->getId()], $dimensionNames);
17
18
        return new static(sprintf('Invalid access "%s".', implode('.', $dimensionNames)));
19
    }
20
}
21