Completed
Push — master ( 68be21...073c54 )
by Kévin
02:41
created

InvalidAccess   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

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