1 | <?php |
||
2 | |||
3 | namespace roaresearch\yii2\roa\behaviors; |
||
4 | |||
5 | use yii\{helpers\Url, web\Link}; |
||
6 | |||
7 | /** |
||
8 | * Behavior to autogenerate curies links. |
||
9 | * |
||
10 | * @author Angel (Faryshta) Guevara <[email protected]> |
||
11 | */ |
||
12 | class Curies extends \yii\base\Behavior |
||
13 | { |
||
14 | /** |
||
15 | * @var Link[] The curies links. Autogenerated links will be stored here. |
||
16 | */ |
||
17 | public array $curiesLinks = []; |
||
18 | |||
19 | /** |
||
20 | * @var ?string name of the autogenerated expand curie. Set `null` if you |
||
21 | * don't want to autogenerate expand curie. |
||
22 | */ |
||
23 | public ?string $expandCurieName = 'expand'; |
||
24 | |||
25 | /** |
||
26 | * @var array the configuration used to generate the expand curie. |
||
27 | */ |
||
28 | public array $expandCurieLink = [ |
||
29 | 'title' => 'Embeddable related resources.', |
||
30 | ]; |
||
31 | |||
32 | /** |
||
33 | * Return all the curies and related links. |
||
34 | * |
||
35 | * @return array the configured and autogenerated curies and related links. |
||
36 | */ |
||
37 | 9 | public function getCuriesLinks(): array |
|
38 | { |
||
39 | 9 | if ($this->expandCurieName) { |
|
40 | 9 | $this->curiesLinks['curies'][] = new Link(array_merge( |
|
41 | 9 | $this->expandCurieLink, |
|
42 | [ |
||
43 | 9 | 'name' => $this->expandCurieName, |
|
44 | 9 | 'href' => $this->owner->getSelfLink() |
|
0 ignored issues
–
show
|
|||
45 | 9 | . "?{$this->expandCurieName}={rel}", |
|
46 | ] |
||
47 | )); |
||
48 | |||
49 | 9 | foreach ($this->owner->extraFields() as $field => $value) { |
|
50 | 9 | if (is_int($field)) { |
|
51 | 9 | $field = $value; |
|
52 | } |
||
53 | |||
54 | 9 | $this->curiesLinks["{$this->expandCurieName}:$field"] = $field; |
|
55 | } |
||
56 | } |
||
57 | |||
58 | 9 | return $this->curiesLinks; |
|
59 | } |
||
60 | } |
||
61 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.