diff --git a/src/Page/AbstractPage.php b/src/Page/AbstractPage.php index a9d0d78..53a6438 100644 --- a/src/Page/AbstractPage.php +++ b/src/Page/AbstractPage.php @@ -876,7 +876,7 @@ public function set($property, $value) ); } - $method = 'set' . self::normalizePropertyName($property); + $method = 'set' . static::normalizePropertyName($property); if ($method != 'setOptions' && method_exists($this, $method) ) { @@ -907,7 +907,7 @@ public function get($property) ); } - $method = 'get' . self::normalizePropertyName($property); + $method = 'get' . static::normalizePropertyName($property); if (method_exists($this, $method)) { return $this->$method(); @@ -963,7 +963,7 @@ public function __get($name) */ public function __isset($name) { - $method = 'get' . self::normalizePropertyName($name); + $method = 'get' . static::normalizePropertyName($name); if (method_exists($this, $method)) { return true; } @@ -982,7 +982,7 @@ public function __isset($name) */ public function __unset($name) { - $method = 'set' . self::normalizePropertyName($name); + $method = 'set' . static::normalizePropertyName($name); if (method_exists($this, $method)) { throw new Exception\InvalidArgumentException( sprintf( diff --git a/src/Page/Mvc.php b/src/Page/Mvc.php index 0a26f23..eefcbcc 100644 --- a/src/Page/Mvc.php +++ b/src/Page/Mvc.php @@ -178,7 +178,7 @@ public function getHref() $router = $this->router; if (null === $router) { - $router = self::$defaultRouter; + $router = static::$defaultRouter; } if (!$router instanceof RouteStackInterface) { @@ -411,7 +411,7 @@ public function setRouter(RouteStackInterface $router) */ public static function setDefaultRouter($router) { - self::$defaultRouter = $router; + static::$defaultRouter = $router; } /** @@ -421,7 +421,7 @@ public static function setDefaultRouter($router) */ public static function getDefaultRouter() { - return self::$defaultRouter; + return static::$defaultRouter; } // Public methods: @@ -440,6 +440,8 @@ public function toArray() 'controller' => $this->getController(), 'params' => $this->getParams(), 'route' => $this->getRoute(), + 'router' => $this->getRouter(), + 'route_match' => $this->getRouteMatch(), ) ); } diff --git a/src/View/HelperConfig.php b/src/View/HelperConfig.php index 08e3397..9fbbe71 100644 --- a/src/View/HelperConfig.php +++ b/src/View/HelperConfig.php @@ -35,7 +35,7 @@ class HelperConfig implements ConfigInterface */ public function configureServiceManager(ServiceManager $serviceManager) { - $serviceManager->setFactory('navigation', function(HelperPluginManager $pm) { + $serviceManager->setFactory('navigation', function (HelperPluginManager $pm) { $helper = new \Zend\View\Helper\Navigation; $helper->setServiceLocator($pm->getServiceLocator()); return $helper; diff --git a/test/Page/MvcTest.php b/test/Page/MvcTest.php index 9c36893..c962268 100644 --- a/test/Page/MvcTest.php +++ b/test/Page/MvcTest.php @@ -418,7 +418,9 @@ public function testToArrayMethod() 'active' => true, 'visible' => false, 'foo' => 'bar', - 'meaning' => 42 + 'meaning' => 42, + 'router' => $this->router, + 'route_match' => $this->routeMatch, ); $page = new Page\Mvc($options); diff --git a/test/ServiceFactoryTest.php b/test/ServiceFactoryTest.php index eb5e47d..910441e 100644 --- a/test/ServiceFactoryTest.php +++ b/test/ServiceFactoryTest.php @@ -48,7 +48,7 @@ protected function setUp() 'extra_config' => array( 'service_manager' => array( 'factories' => array( - 'Config' => function() { + 'Config' => function () { return array( 'navigation' => array( 'file' => __DIR__ . '/_files/navigation.xml', @@ -119,7 +119,7 @@ public function testMvcPagesGetInjectedWithComponents() $this->serviceManager->setFactory('Navigation', 'Zend\Navigation\Service\DefaultNavigationFactory'); $container = $this->serviceManager->get('Navigation'); - $recursive = function($that, $pages) use (&$recursive) { + $recursive = function ($that, $pages) use (&$recursive) { foreach ($pages as $page) { if ($page instanceof MvcPage) { $that->assertInstanceOf('Zend\Mvc\Router\RouteStackInterface', $page->getRouter());