Conditions | 5 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | public function getUri($resource) |
||
42 | { |
||
43 | if (empty($resource) || !is_string($resource)) { |
||
44 | throw new \InvalidArgumentException('The resource has to be string and cannot be empty.'); |
||
45 | } |
||
46 | if (isset($this->uriMapping[$resource])) { |
||
47 | return $this->uriMapping[$resource]; |
||
48 | } |
||
49 | if ($this->allowDefaultUris) { |
||
50 | return $resource; |
||
51 | } |
||
52 | throw new \InvalidArgumentException('No mapping defined for a given resource.'); |
||
53 | } |
||
54 | } |
||
55 |