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

Commit

Permalink
Merge branch 'master' of git://github.com/zendframework/zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 16 changed files with 231 additions and 326 deletions.
14 changes: 0 additions & 14 deletions .travis/run-tests.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .travis/skipped-components

This file was deleted.

61 changes: 0 additions & 61 deletions .travis/tested-components

This file was deleted.

2 changes: 1 addition & 1 deletion src/Adapter/ArrayAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ArrayAdapter implements AdapterInterface
*
* @param array $array ArrayAdapter to paginate
*/
public function __construct(array $array)
public function __construct(array $array = array())
{
$this->_array = $array;
$this->_count = count($array);
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Null.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Null implements AdapterInterface
* @param integer $count Total item count (Optional)
*/
public function __construct($count = 0)
{;
{
$this->_count = $count;
}

Expand Down
50 changes: 0 additions & 50 deletions src/AdapterBroker.php

This file was deleted.

35 changes: 0 additions & 35 deletions src/AdapterLoader.php

This file was deleted.

79 changes: 79 additions & 0 deletions src/AdapterPluginManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Paginator
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Paginator;

use Zend\ServiceManager\AbstractPluginManager;

/**
* Plugin manager implementation for pagination adapters
*
* Enforces that adapters retrieved are instances of
* Adapter\AdapterInterface. Additionally, it registers a number
* of default adapters available.
*
* @category Zend
* @package Zend_Paginator
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class AdapterPluginManager extends AbstractPluginManager
{
/**
* Default set of adapters
*
* @var array
*/
protected $invokableClasses = array(
'array' => 'Zend\Paginator\Adapter\ArrayAdapter',
'dbselect' => 'Zend\Paginator\Adapter\DbSelect',
'dbtableselect' => 'Zend\Paginator\Adapter\DbTableSelect',
'iterator' => 'Zend\Paginator\Adapter\Iterator',
'null' => 'Zend\Paginator\Adapter\Null',
);

/**
* @var bool Do not share by default
*/
protected $shareByDefault = false;

/**
* Validate the plugin
*
* Checks that the adapter loaded is an instance of Adapter\AdapterInterface.
*
* @param mixed $plugin
* @return void
* @throws Exception\InvalidArgumentException if invalid
*/
public function validatePlugin($plugin)
{
if ($plugin instanceof Adapter\AdapterInterface) {
// we're okay
return;
}

throw new Exception\InvalidArgumentException(sprintf(
'Plugin of type %s is invalid; must implement %s\Adapter\AdapterInterface',
(is_object($plugin) ? get_class($plugin) : gettype($plugin)),
__NAMESPACE__
));
}
}
Loading

0 comments on commit 1d6c476

Please sign in to comment.