Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
47 | public function addHrefLang(string $hrefLang, string $href): self |
||
48 | { |
||
49 | preg_match_all("/^(?'hreflang'([a-z]{2}|(x)){1}((-){1}([A-Za-z]{2}|[A-Z]{1}([a-z]{1}|[a-z]{3})|(default)))?)$/", |
||
50 | $hrefLang, $matches); |
||
51 | |||
52 | if (!empty($matches['hreflang'])) { |
||
53 | $this->hrefLang[$hrefLang] = $href; |
||
54 | } else { |
||
55 | throw new InvalidArgumentException('Invalid hreflang parameter.'); |
||
56 | } |
||
57 | |||
58 | return $this; |
||
59 | } |
||
97 |