Conditions | 6 |
Paths | 4 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
32 | public function get($rel) |
||
33 | { |
||
34 | if (array_key_exists($rel, (array) $this)) { |
||
35 | return $this[$rel]; |
||
36 | } |
||
37 | |||
38 | if (isset($this['curies'])) { |
||
39 | foreach ($this['curies'] as $link) { |
||
40 | $prefix = strstr($link->getUri(), '{rel}', true); |
||
41 | if (strpos($rel, $prefix) === 0) { |
||
42 | // looks like it is |
||
43 | $shortrel = substr($rel, strlen($prefix)); |
||
44 | $attrs = $link->getAttributes(); |
||
45 | $curie = "{$attrs['name']}:$shortrel"; |
||
46 | if (isset($this[$curie])) { |
||
47 | return $this[$curie]; |
||
48 | } |
||
49 | } |
||
50 | } |
||
51 | } |
||
52 | |||
53 | return false; |
||
54 | } |
||
55 | } |
||
56 |