@@ -192,19 +192,31 @@ public function getContainer()
192192 return $ this ->container ;
193193 }
194194
195+ /**
196+ * Verifies container and eventually fetches it from service locator if it is a string
197+ *
198+ * @param \Zend\Navigation\AbstractContainer|string|null $container
199+ * @throws \Zend\View\Exception\InvalidArgumentException
200+ */
195201 protected function parseContainer (&$ container = null )
196202 {
197203 if (null === $ container ) {
198- ; // intentionally left blank
199- } else if (is_string ($ container )) {
204+ return ;
205+ }
206+
207+ if (is_string ($ container )) {
200208 if (!$ this ->getServiceLocator ()) {
201209 throw new Exception \InvalidArgumentException (sprintf (
202- 'Attempted to set container with alias "%s" but no ServiceLocator wwas set ' ,
210+ 'Attempted to set container with alias "%s" but no ServiceLocator was set ' ,
203211 $ container
204212 ));
205213 }
214+
206215 $ container = $ this ->getServiceLocator ()->get ($ container );
207- } else if (!$ container instanceof Navigation \AbstractContainer) {
216+ return ;
217+ }
218+
219+ if (!$ container instanceof Navigation \AbstractContainer) {
208220 throw new Exception \InvalidArgumentException (
209221 'Container must be a string alias or an instance of ' .
210222 'Zend\Navigation\AbstractContainer '
@@ -215,7 +227,7 @@ protected function parseContainer(&$container = null)
215227 /**
216228 * Sets the minimum depth a page must have to be included when rendering
217229 *
218- * @param int $minDepth [optional] minimum depth. Default is null, which
230+ * @param int $minDepth [optional] minimum depth. Default is null, which
219231 * sets no minimum depth.
220232 * @return AbstractHelper fluent interface, returns self
221233 */
@@ -245,7 +257,7 @@ public function getMinDepth()
245257 /**
246258 * Sets the maximum depth a page can have to be included when rendering
247259 *
248- * @param int $maxDepth [optional] maximum depth. Default is null, which
260+ * @param int $maxDepth [optional] maximum depth. Default is null, which
249261 * sets no maximum depth.
250262 * @return AbstractHelper fluent interface, returns self
251263 */
@@ -297,9 +309,9 @@ public function getIndent()
297309 *
298310 * Implements {@link HelperInterface::setTranslator()}.
299311 *
300- * @param mixed $translator [optional] translator. Expects an object of
312+ * @param mixed $translator [optional] translator. Expects an object of
301313 * type {@link Translator\Adapter\AbstractAdapter}
302- * or {@link Translator\Translator}, or null.
314+ * or {@link Translator\Translator}, or null.
303315 * Default is null, which sets no translator.
304316 * @return AbstractHelper fluent interface, returns self
305317 */
@@ -363,7 +375,7 @@ public function getAcl()
363375 *
364376 * Implements {@link HelperInterface::setRole()}.
365377 *
366- * @param mixed $role [optional] role to set. Expects a string, an
378+ * @param mixed $role [optional] role to set. Expects a string, an
367379 * instance of type {@link Acl\Role\RoleInterface}, or null. Default
368380 * is null, which will set no role.
369381 * @return AbstractHelper fluent interface, returns self
@@ -377,7 +389,7 @@ public function setRole($role = null)
377389 $ this ->role = $ role ;
378390 } else {
379391 throw new Exception \InvalidArgumentException (sprintf (
380- '$role must be a string, null, or an instance of '
392+ '$role must be a string, null, or an instance of '
381393 . 'Zend\Acl\Role\RoleInterface; %s given ' ,
382394 (is_object ($ role ) ? get_class ($ role ) : gettype ($ role ))
383395 ));
@@ -456,7 +468,7 @@ public function setRenderInvisible($renderInvisible = true)
456468 *
457469 * Implements {@link HelperInterface::setUseTranslator()}.
458470 *
459- * @param bool $useTranslator [optional] whether translator should be used.
471+ * @param bool $useTranslator [optional] whether translator should be used.
460472 * Default is true.
461473 * @return AbstractHelper fluent interface, returns self
462474 */
@@ -691,8 +703,8 @@ public function htmlify(AbstractPage $page)
691703 * will not be accepted if it is the descendant of a non-accepted page.
692704 *
693705 * @param AbstractPage $page page to check
694- * @param bool $recursive [optional] if true, page will not be
695- * accepted if it is the descendant of a
706+ * @param bool $recursive [optional] if true, page will not be
707+ * accepted if it is the descendant of a
696708 * page that is not accepted. Default is true.
697709 * @return bool whether page should be accepted
698710 */
@@ -822,16 +834,16 @@ public static function setDefaultAcl(Acl\Acl $acl = null)
822834 * Sets default ACL role(s) to use when iterating pages if not explicitly
823835 * set later with {@link setRole()}
824836 *
825- * @param mixed $role [optional] role to set. Expects null, string, or an
837+ * @param mixed $role [optional] role to set. Expects null, string, or an
826838 * instance of {@link Acl\Role\RoleInterface}. Default is null, which
827839 * sets no default role.
828840 * @return void
829841 * @throws Exception\InvalidArgumentException if role is invalid
830842 */
831843 public static function setDefaultRole ($ role = null )
832844 {
833- if (null === $ role
834- || is_string ($ role )
845+ if (null === $ role
846+ || is_string ($ role )
835847 || $ role instanceof Acl \Role \RoleInterface
836848 ) {
837849 self ::$ defaultRole = $ role ;
0 commit comments