Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'develop' of git://github.com/zendframework/zf2 into fea…
Browse files Browse the repository at this point in the history
…ture/cache-session-storage

Conflicts:
	CHANGELOG.md
  • Loading branch information
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions src/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -194,7 +194,7 @@ public static function setGlobalConfig($config)
*/
public static function getDefaultScrollingStyle()
{
return self::$defaultScrollingStyle;
return static::$defaultScrollingStyle;
}

/**
Expand All @@ -204,7 +204,7 @@ public static function getDefaultScrollingStyle()
*/
public static function getDefaultItemCountPerPage()
{
return self::$defaultItemCountPerPage;
return static::$defaultItemCountPerPage;
}

/**
Expand All @@ -214,7 +214,7 @@ public static function getDefaultItemCountPerPage()
*/
public static function setDefaultItemCountPerPage($count)
{
self::$defaultItemCountPerPage = (int) $count;
static::$defaultItemCountPerPage = (int) $count;
}

/**
Expand All @@ -224,7 +224,7 @@ public static function setDefaultItemCountPerPage($count)
*/
public static function setCache(CacheStorage $cache)
{
self::$cache = $cache;
static::$cache = $cache;
}

/**
Expand All @@ -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)
Expand All @@ -254,7 +254,7 @@ public static function setScrollingStylePluginManager($scrollingAdapters)
(is_object($scrollingAdapters) ? get_class($scrollingAdapters) : gettype($scrollingAdapters))
));
}
self::$scrollingStyles = $scrollingAdapters;
static::$scrollingStyles = $scrollingAdapters;
}

/**
Expand All @@ -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;
}

/**
Expand All @@ -291,7 +291,7 @@ public function __construct($adapter)
);
}

$config = self::$config;
$config = static::$config;

if (!empty($config)) {
$setupMethods = array('ItemCountPerPage', 'PageRange');
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -839,7 +839,7 @@ public function toJson()
*/
protected function cacheEnabled()
{
return ((self::$cache !== null) && $this->cacheEnabled);
return ((static::$cache !== null) && $this->cacheEnabled);
}

/**
Expand Down Expand Up @@ -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))) {
Expand All @@ -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
Expand Down

0 comments on commit c222657

Please sign in to comment.