| Conditions | 5 |
| Paths | 5 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5.0144 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 4 | public function alternateFormats(array $formats, $title = null) |
|
| 26 | { |
||
| 27 | 4 | $formatLinks = []; |
|
| 28 | 4 | foreach ($formats as $format => $url) { |
|
| 29 | // Inject format and locale parameters |
||
| 30 | 4 | if (mb_strpos($url, '?') === false) { |
|
| 31 | 3 | $url .= '?'; |
|
| 32 | } else { |
||
| 33 | 1 | $url .= '&'; |
|
| 34 | } |
||
| 35 | |||
| 36 | 4 | $url .= 'format=' . $format . '&lang=' . Zend_Registry::get('Zend_Locale')->getLanguage(); |
|
| 37 | |||
| 38 | 4 | $formatLinks[] = '<a class="' . $format . '" href="' . $url . '">' . self::$supportedFormats[$format]['name'] . '</a>'; |
|
| 39 | 4 | if ($title && isset(self::$supportedFormats[$format]['mime'])) { |
|
| 40 | $this->view->headLink()->appendAlternate($url, self::$supportedFormats[$format]['mime'], $title); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | 4 | $result = '<p class="alternateFormats">' . $this->view->translate('Also available in:') . ' ' . implode(' | ', $formatLinks) . '</p>'; |
|
| 45 | |||
| 46 | 4 | return $result; |
|
| 47 | } |
||
| 48 | } |
||
| 49 |
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.