Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
67 | 1 | public function toArray(): array |
|
68 | { |
||
69 | $array = [ |
||
70 | 1 | '_namespace' => static::NAMESPACE_NAME, |
|
71 | 1 | '_element' => 'link', |
|
72 | 'link' => [] |
||
73 | ]; |
||
74 | |||
75 | 1 | foreach ($this->getHrefLang() as $hreflang => $lang) { |
|
76 | 1 | $array['link'][] = [ |
|
77 | '_attributes' => [ |
||
78 | 1 | 'rel' => 'alternate', |
|
79 | 1 | 'hreflang' => $hreflang, |
|
80 | 1 | 'href' => $lang['href'] |
|
81 | ] |
||
82 | ]; |
||
83 | } |
||
84 | |||
85 | 1 | return $array; |
|
86 | } |
||
87 | } |
||
88 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.