Skip to content

Commit

Permalink
Merge pull request #81 from basz/exception-in-to-string
Browse files Browse the repository at this point in the history
shouldn’t throw exception in __toString magic method
  • Loading branch information
basz authored Mar 15, 2017
2 parents 9f03a42 + c45d19d commit 2009198
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 2009198

Please sign in to comment.