Skip to content

Commit

Permalink
shouldn’t throw exception in __toString magic method
Browse files Browse the repository at this point in the history
  • Loading branch information
basz committed Mar 15, 2017
1 parent 076e1f3 commit c45d19d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/SlmLocale/View/Helper/LocaleMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,12 @@ public function __invoke()
/**
* @param array $options
* @return string
* @throws RuntimeException
* @todo implement add way to completely default rendering for maximum flexibility (see Zend\View\Helper\Navigation::renderPartial)
*/
public function __toString()
{
if (! ($detector = $this->getDetector())) {
throw new RuntimeException('To assemble an url, a detector is required');
return sprintf('<ul%s></ul>', ($this->getUlClass()) ? sprintf(' class="%s"', $this->getUlClass()) : '');
}

$list = '';
Expand Down

0 comments on commit c45d19d

Please sign in to comment.