Permalink
Browse files

CS space & returning instance

CS space & returning instance
  • Loading branch information...
1 parent dd24e43 commit 9b1378c739d007e5f9148cc8222573c289453a66 @blanchonvincent blanchonvincent committed Oct 8, 2012
Showing with 7 additions and 9 deletions.
  1. +3 −5 library/Zend/Paginator/AdapterPluginManager.php
  2. +4 −4 library/Zend/Paginator/Factory.php
@@ -54,17 +54,15 @@ protected function createFromInvokable($canonicalName, $requestedName)
if (null === $this->creationOptions
|| (is_array($this->creationOptions) && empty($this->creationOptions))
) {
- $instance = new $invokable();
+ return new $invokable();
} else {
if($canonicalName == "dbselect" && is_array($this->creationOptions)) {
$class = new \ReflectionClass($invokable);
- $instance = $class->newInstanceArgs($this->creationOptions);
+ return $class->newInstanceArgs($this->creationOptions);
} else {
- $instance = new $invokable($this->creationOptions);
+ return new $invokable($this->creationOptions);
}
}
-
- return $instance;
}
/**
@@ -24,18 +24,18 @@
public static function factory($items, $adapter = null)
{
- if(null === $adapter) {
+ if (null === $adapter) {
if ($items instanceof Traversable) {
$items = ArrayUtils::iteratorToArray($items);
}
- if(!is_array($items)) {
+ if (!is_array($items)) {
throw new Exception\InvalidArgumentException(
'The factory needs an associative array '
. 'or a Traversable object as an argument when '
. "it's used with one parameter"
);
}
- if(!isset($items['adapter']) && !isset($items['items'])) {
+ if (!isset($items['adapter']) && !isset($items['items'])) {
throw new Exception\InvalidArgumentException(
'The factory needs an associative array '
. 'or a Traversable object with keys '
@@ -45,7 +45,7 @@ public static function factory($items, $adapter = null)
$adapter = $items['adapter'];
$items = $items['items'];
}
- if(!$adapter instanceof AdapterInterface && !$adapter instanceof AdapterAggregateInterface) {
+ if (!$adapter instanceof AdapterInterface && !$adapter instanceof AdapterAggregateInterface) {
$adapter = self::getAdapterPluginManager()->get($adapter, $items);
}

0 comments on commit 9b1378c

Please sign in to comment.