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

Commit

Permalink
change substr with strpos when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed May 8, 2018
1 parent b4e853e commit d70ba5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Paginator.php
Expand Up @@ -373,7 +373,7 @@ public function clearPageItemCache($pageNumber = null)
$cacheIterator = static::$cache->getIterator();
$cacheIterator->setMode(CacheIterator::CURRENT_AS_KEY);
foreach ($cacheIterator as $key) {
if (substr($key, 0, $prefixLength) == self::CACHE_TAG_PREFIX) {
if (0 === strpos($key, self::CACHE_TAG_PREFIX)) {
static::$cache->removeItem($this->_getCacheId((int)substr($key, $prefixLength)));
}
}
Expand Down Expand Up @@ -707,7 +707,7 @@ public function getPageItemCache()
$cacheIterator = static::$cache->getIterator();
$cacheIterator->setMode(CacheIterator::CURRENT_AS_VALUE);
foreach ($cacheIterator as $key => $value) {
if (substr($key, 0, $prefixLength) == self::CACHE_TAG_PREFIX) {
if (0 === strpos($key, self::CACHE_TAG_PREFIX)) {
$data[(int) substr($key, $prefixLength)] = $value;
}
}
Expand Down

0 comments on commit d70ba5f

Please sign in to comment.