Conditions | 5 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5.0144 |
Changes | 0 |
1 | <?php |
||
28 | 4 | public function alternateFormats(array $formats, $title = null) |
|
29 | { |
||
30 | 4 | $formatLinks = []; |
|
31 | 4 | foreach ($formats as $format => $url) { |
|
32 | // Inject format and locale parameters |
||
33 | 4 | if (mb_strpos($url, '?') === false) { |
|
34 | 3 | $url .= '?'; |
|
35 | } else { |
||
36 | 1 | $url .= '&'; |
|
37 | } |
||
38 | |||
39 | 4 | $url .= 'format=' . $format . '&lang=' . Zend_Registry::get(Zend_Locale::class)->getLanguage(); |
|
40 | |||
41 | 4 | $formatLinks[] = '<a class="' . $format . '" href="' . $url . '">' . self::$supportedFormats[$format]['name'] . '</a>'; |
|
42 | 4 | if ($title && isset(self::$supportedFormats[$format]['mime'])) { |
|
43 | $this->view->headLink()->appendAlternate($url, self::$supportedFormats[$format]['mime'], $title); |
||
44 | } |
||
45 | } |
||
46 | |||
47 | 4 | $result = '<p class="alternateFormats">' . $this->view->translate('Also available in:') . ' ' . implode(' | ', $formatLinks) . '</p>'; |
|
48 | |||
49 | 4 | return $result; |
|
50 | } |
||
52 |