diff --git a/src/Paginator.php b/src/Paginator.php index 1cca2f5..21c84b9 100644 --- a/src/Paginator.php +++ b/src/Paginator.php @@ -172,18 +172,18 @@ public static function setGlobalConfig($config) throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable'); } - self::$config = $config; + static::$config = $config; if (isset($config['scrolling_style_plugins']) && null !== ($adapters = $config['scrolling_style_plugins']) ) { - self::setScrollingStylePluginManager($adapters); + static::setScrollingStylePluginManager($adapters); } $scrollingStyle = isset($config['scrolling_style']) ? $config['scrolling_style'] : null; if ($scrollingStyle != null) { - self::setDefaultScrollingStyle($scrollingStyle); + static::setDefaultScrollingStyle($scrollingStyle); } } @@ -194,7 +194,7 @@ public static function setGlobalConfig($config) */ public static function getDefaultScrollingStyle() { - return self::$defaultScrollingStyle; + return static::$defaultScrollingStyle; } /** @@ -204,7 +204,7 @@ public static function getDefaultScrollingStyle() */ public static function getDefaultItemCountPerPage() { - return self::$defaultItemCountPerPage; + return static::$defaultItemCountPerPage; } /** @@ -214,7 +214,7 @@ public static function getDefaultItemCountPerPage() */ public static function setDefaultItemCountPerPage($count) { - self::$defaultItemCountPerPage = (int) $count; + static::$defaultItemCountPerPage = (int) $count; } /** @@ -224,7 +224,7 @@ public static function setDefaultItemCountPerPage($count) */ public static function setCache(CacheStorage $cache) { - self::$cache = $cache; + static::$cache = $cache; } /** @@ -234,7 +234,7 @@ public static function setCache(CacheStorage $cache) */ public static function setDefaultScrollingStyle($scrollingStyle = 'Sliding') { - self::$defaultScrollingStyle = $scrollingStyle; + static::$defaultScrollingStyle = $scrollingStyle; } public static function setScrollingStylePluginManager($scrollingAdapters) @@ -254,7 +254,7 @@ public static function setScrollingStylePluginManager($scrollingAdapters) (is_object($scrollingAdapters) ? get_class($scrollingAdapters) : gettype($scrollingAdapters)) )); } - self::$scrollingStyles = $scrollingAdapters; + static::$scrollingStyles = $scrollingAdapters; } /** @@ -265,11 +265,11 @@ public static function setScrollingStylePluginManager($scrollingAdapters) */ public static function getScrollingStylePluginManager() { - if (self::$scrollingStyles === null) { - self::$scrollingStyles = new ScrollingStylePluginManager(); + if (static::$scrollingStyles === null) { + static::$scrollingStyles = new ScrollingStylePluginManager(); } - return self::$scrollingStyles; + return static::$scrollingStyles; } /** @@ -291,7 +291,7 @@ public function __construct($adapter) ); } - $config = self::$config; + $config = static::$config; if (!empty($config)) { $setupMethods = array('ItemCountPerPage', 'PageRange'); @@ -375,19 +375,19 @@ public function clearPageItemCache($pageNumber = null) if (null === $pageNumber) { $prefixLength = strlen(self::CACHE_TAG_PREFIX); - $cacheIterator = self::$cache->getIterator(); + $cacheIterator = static::$cache->getIterator(); $cacheIterator->setMode(CacheIterator::CURRENT_AS_KEY); foreach ($cacheIterator as $key) { - $tags = self::$cache->getTags($key); + $tags = static::$cache->getTags($key); if ($tags && in_array($this->_getCacheInternalId(), $tags)) { if (substr($key, 0, $prefixLength) == self::CACHE_TAG_PREFIX) { - self::$cache->removeItem($this->_getCacheId((int)substr($key, $prefixLength))); + static::$cache->removeItem($this->_getCacheId((int)substr($key, $prefixLength))); } } } } else { $cleanId = $this->_getCacheId($pageNumber); - self::$cache->removeItem($cleanId); + static::$cache->removeItem($cleanId); } return $this; } @@ -544,7 +544,7 @@ public function getItem($itemNumber, $pageNumber = null) public function getItemCountPerPage() { if (empty($this->itemCountPerPage)) { - $this->itemCountPerPage = self::getDefaultItemCountPerPage(); + $this->itemCountPerPage = static::getDefaultItemCountPerPage(); } return $this->itemCountPerPage; @@ -599,7 +599,7 @@ public function getItemsByPage($pageNumber) $pageNumber = $this->normalizePageNumber($pageNumber); if ($this->cacheEnabled()) { - $data = self::$cache->getItem($this->_getCacheId($pageNumber)); + $data = static::$cache->getItem($this->_getCacheId($pageNumber)); if ($data) { return $data; } @@ -621,8 +621,8 @@ public function getItemsByPage($pageNumber) if ($this->cacheEnabled()) { $cacheId = $this->_getCacheId($pageNumber); - self::$cache->setItem($cacheId, $items); - self::$cache->setTags($cacheId, array($this->_getCacheInternalId())); + static::$cache->setItem($cacheId, $items); + static::$cache->setTags($cacheId, array($this->_getCacheInternalId())); } return $items; @@ -712,10 +712,10 @@ public function getPageItemCache() $data = array(); if ($this->cacheEnabled()) { $prefixLength = strlen(self::CACHE_TAG_PREFIX); - $cacheIterator = self::$cache->getIterator(); + $cacheIterator = static::$cache->getIterator(); $cacheIterator->setMode(CacheIterator::CURRENT_AS_VALUE); foreach ($cacheIterator as $key => $value) { - $tags = self::$cache->getTags($key); + $tags = static::$cache->getTags($key); if ($tags && in_array($this->_getCacheInternalId(), $tags)) { if (substr($key, 0, $prefixLength) == self::CACHE_TAG_PREFIX) { $data[(int) substr($key, $prefixLength)] = $value; @@ -839,7 +839,7 @@ public function toJson() */ protected function cacheEnabled() { - return ((self::$cache !== null) && $this->cacheEnabled); + return ((static::$cache !== null) && $this->cacheEnabled); } /** @@ -941,7 +941,7 @@ protected function _createPages($scrollingStyle = null) protected function _loadScrollingStyle($scrollingStyle = null) { if ($scrollingStyle === null) { - $scrollingStyle = self::$defaultScrollingStyle; + $scrollingStyle = static::$defaultScrollingStyle; } switch (strtolower(gettype($scrollingStyle))) { @@ -955,7 +955,7 @@ protected function _loadScrollingStyle($scrollingStyle = null) return $scrollingStyle; case 'string': - return self::getScrollingStylePluginManager()->get($scrollingStyle); + return static::getScrollingStylePluginManager()->get($scrollingStyle); case 'null': // Fall through to default case