IdentifiersProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getIdentifiers() 0 7 2
A setProvider() 0 3 1
1
<?php
2
namespace rtens\domin\parameters;
3
4
class IdentifiersProvider {
5
6
    /** @var array|callable[] */
7
    private $providers = [];
8
9
    public function getIdentifiers($class) {
10
        if (!array_key_exists($class, $this->providers)) {
11
            throw new \Exception("No identifier provider registered for [$class]");
12
        }
13
14
        return call_user_func($this->providers[$class]);
15
    }
16
17
    public function setProvider($class, callable $provider) {
18
        $this->providers[$class] = $provider;
19
    }
20
}