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

Commit

Permalink
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/Adapter/DbSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function setRowCount($rowCount)
$result = $rowCount->query(Db\Db::FETCH_ASSOC)->fetch();

$this->_rowCount = count($result) > 0 ? $result[$rowCountColumn] : 0;
} else if (is_integer($rowCount)) {
} elseif (is_integer($rowCount)) {
$this->_rowCount = $rowCount;
} else {
throw new Exception\InvalidArgumentException('Invalid row count');
Expand Down Expand Up @@ -183,7 +183,7 @@ public function getCountSelect()
*/
if (($isDistinct && count($columnParts) > 1) || count($groupParts) > 1 || !empty($havingParts)) {
$rowCount = $db->select()->from($this->_select);
} else if ($isDistinct) {
} elseif ($isDistinct) {
$part = $columnParts[0];

if ($part[1] !== Sql\Select::SQL_WILDCARD && !($part[1] instanceof Sql\ExpressionInterface)) {
Expand All @@ -195,7 +195,7 @@ public function getCountSelect()

$groupPart = $column;
}
} else if (!empty($groupParts) && $groupParts[0] !== Sql\Select::SQL_WILDCARD &&
} elseif (!empty($groupParts) && $groupParts[0] !== Sql\Select::SQL_WILDCARD &&
!($groupParts[0] instanceof Sql\ExpressionInterface)
) {
$groupPart = $db->quoteIdentifier($groupParts[0], true);
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* @package Zend\Paginator\Adapter
* @subpackage Exception
*/
class InvalidArgumentException extends Exception\InvalidArgumentException implements
class InvalidArgumentException extends Exception\InvalidArgumentException implements
ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Adapter/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* @package Zend\Paginator\Adapter
* @subpackage Exception
*/
class RuntimeException extends Exception\RuntimeException implements
class RuntimeException extends Exception\RuntimeException implements
ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Adapter/Exception/UnexpectedValueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* @package Zend\Paginator\Adapter
* @subpackage Exception
*/
class UnexpectedValueException extends Exception\UnexpectedValueException implements
class UnexpectedValueException extends Exception\UnexpectedValueException implements
ExceptionInterface
{}
8 changes: 4 additions & 4 deletions src/AdapterPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin manager implementation for pagination adapters
*
* Enforces that adapters retrieved are instances of
* Adapter\AdapterInterface. Additionally, it registers a number
* Adapter\AdapterInterface. Additionally, it registers a number
* of default adapters available.
*
* @category Zend
Expand All @@ -26,7 +26,7 @@ class AdapterPluginManager extends AbstractPluginManager
{
/**
* Default set of adapters
*
*
* @var array
*/
protected $invokableClasses = array(
Expand All @@ -46,8 +46,8 @@ class AdapterPluginManager extends AbstractPluginManager
* Validate the plugin
*
* Checks that the adapter loaded is an instance of Adapter\AdapterInterface.
*
* @param mixed $plugin
*
* @param mixed $plugin
* @return void
* @throws Exception\InvalidArgumentException if invalid
*/
Expand Down
12 changes: 6 additions & 6 deletions src/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,13 @@ public static function factory($data, $adapter = self::INTERNAL_ADAPTER,
if ($adapter == self::INTERNAL_ADAPTER) {
if (is_array($data)) {
$adapter = 'array';
} else if ($data instanceof DbTableSelect) {
} elseif ($data instanceof DbTableSelect) {
$adapter = 'db_table_select';
} else if ($data instanceof DbSelect) {
} elseif ($data instanceof DbSelect) {
$adapter = 'db_select';
} else if ($data instanceof Iterator) {
} elseif ($data instanceof Iterator) {
$adapter = 'iterator';
} else if (is_integer($data)) {
} elseif (is_integer($data)) {
$adapter = 'null';
} else {
$type = (is_object($data)) ? get_class($data) : gettype($data);
Expand Down Expand Up @@ -375,7 +375,7 @@ public function __construct($adapter)
{
if ($adapter instanceof AdapterInterface) {
$this->_adapter = $adapter;
} else if ($adapter instanceof AdapterAggregateInterface) {
} elseif ($adapter instanceof AdapterAggregateInterface) {
$this->_adapter = $adapter->getPaginatorAdapter();
} else {
throw new Exception\InvalidArgumentException(
Expand Down Expand Up @@ -604,7 +604,7 @@ public function getItem($itemNumber, $pageNumber = null)
{
if ($pageNumber == null) {
$pageNumber = $this->getCurrentPageNumber();
} else if ($pageNumber < 0) {
} elseif ($pageNumber < 0) {
$pageNumber = ($this->count() + 1) + $pageNumber;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ScrollingStyle/Elastic.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function getPages(Paginator $paginator, $pageRange = null)

if ($originalPageRange + $pageNumber - 1 < $pageRange) {
$pageRange = $originalPageRange + $pageNumber - 1;
} else if ($originalPageRange + $pageNumber - 1 > count($paginator)) {
} elseif ($originalPageRange + $pageNumber - 1 > count($paginator)) {
$pageRange = $originalPageRange + count($paginator) - $pageNumber;
}

Expand Down
8 changes: 4 additions & 4 deletions src/ScrollingStylePluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin manager implementation for scrolling style adapters
*
* Enforces that adapters retrieved are instances of
* ScrollingStyle\ScrollingStyleInterface. Additionally, it registers a number
* ScrollingStyle\ScrollingStyleInterface. Additionally, it registers a number
* of default adapters available.
*
* @category Zend
Expand All @@ -26,7 +26,7 @@ class ScrollingStylePluginManager extends AbstractPluginManager
{
/**
* Default set of adapters
*
*
* @var array
*/
protected $invokableClasses = array(
Expand All @@ -40,8 +40,8 @@ class ScrollingStylePluginManager extends AbstractPluginManager
* Validate the plugin
*
* Checks that the adapter loaded is an instance of ScrollingStyle\ScrollingStyleInterface.
*
* @param mixed $plugin
*
* @param mixed $plugin
* @return void
* @throws Exception\InvalidArgumentException if invalid
*/
Expand Down
5 changes: 3 additions & 2 deletions test/Adapter/ArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ public function testReturnsCorrectCount()
{
$this->assertEquals(101, $this->_adapter->count());
}


/**
* @group ZF-4151
*/
public function testEmptySet() {
public function testEmptySet()
{
$this->_adapter = new Adapter\ArrayAdapter(array());
$actual = $this->_adapter->getItems(0, 10);
$this->assertEquals(array(), $actual);
Expand Down
6 changes: 4 additions & 2 deletions test/Adapter/IteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public function testDoesNotThrowOutOfBoundsExceptionIfIteratorIsEmpty()
/**
* @group ZF-8084
*/
public function testGetItemsSerializable() {
public function testGetItemsSerializable()
{
$items = $this->_adapter->getItems(0, 1);
$innerIterator = $items->getInnerIterator();
$items = unserialize(serialize($items));
Expand All @@ -105,7 +106,8 @@ public function testGetItemsSerializable() {
/**
* @group ZF-4151
*/
public function testEmptySet() {
public function testEmptySet()
{
$iterator = new \ArrayIterator(array());
$this->_adapter = new Adapter\Iterator($iterator);
$actual = $this->_adapter->getItems(0, 10);
Expand Down
8 changes: 5 additions & 3 deletions test/Adapter/NullTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,18 @@ public function testAdapterReturnsCorrectValues()
/**
* @group ZF-4151
*/
public function testEmptySet() {
public function testEmptySet()
{
$this->_adapter = new Adapter\Null(0);
$actual = $this->_adapter->getItems(0, 10);
$this->assertEquals(array(), $actual);
}

/**
* Verify that the fix for ZF-4151 doesn't create an OBO error
*/
public function testSetOfOne() {
public function testSetOfOne()
{
$this->_adapter = new Adapter\Null(1);
$actual = $this->_adapter->getItems(0, 10);
$this->assertEquals(array_fill(0, 1, null), $actual);
Expand Down

0 comments on commit aff706f

Please sign in to comment.