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