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

Commit

Permalink
Merge branch 'master' of git://github.com/zendframework/zf2 into cach…
Browse files Browse the repository at this point in the history
…e_plugin_priority

Conflicts:
	library/Zend/Cache/Storage/Adapter/AbstractAdapter.php
	library/Zend/Cache/Storage/Plugin/ClearByFactor.php
	library/Zend/Cache/Storage/Plugin/ExceptionHandler.php
	library/Zend/Cache/Storage/Plugin/IgnoreUserAbort.php
	library/Zend/Cache/Storage/Plugin/OptimizeByFactor.php
	library/Zend/Cache/Storage/Plugin/Serializer.php
  • Loading branch information
Show file tree
Hide file tree
Showing 27 changed files with 131 additions and 124 deletions.
7 changes: 6 additions & 1 deletion src/AbstractManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@

namespace Zend\Session;

use Zend\Session\ManagerInterface as Manager,
Zend\Session\SaveHandler\SaveHandlerInterface as SaveHandler,
Zend\Session\Storage\StorageInterface as Storage,
Zend\Session\Configuration\ConfigurationInterface as Configuration;

/**
* Base Manager implementation
* Base ManagerInterface implementation
*
* Defines common constructor logic and getters for Storage and Configuration
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Session;
namespace Zend\Session\Configuration;

/**
* Standard session configuration
Expand All @@ -28,7 +28,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Configuration
interface ConfigurationInterface
{
public function setOptions(array $options);
public function setOption($option, $value);
Expand Down
20 changes: 14 additions & 6 deletions src/Configuration/SessionConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace Zend\Session\Configuration;

use Zend\Validator\Hostname\Hostname as HostnameValidator,
use Zend\Validator\Hostname as HostnameValidator,
Zend\Session\Exception;

/**
Expand Down Expand Up @@ -88,7 +88,7 @@ class SessionConfiguration extends StandardConfiguration
*
* @param string $storageName
* @param mixed $storageValue
* @return Zend\Session\Configuration\StandardConfiguration
* @return SessionConfiguration
*/
public function setStorageOption($storageName, $storageValue)
{
Expand All @@ -106,6 +106,7 @@ public function setStorageOption($storageName, $storageValue)
}

ini_set($key, $storageValue);
return $this;
}

/**
Expand Down Expand Up @@ -165,7 +166,7 @@ protected function handleError($code, $message)
*
* @param string $phpSaveHandler
* @return SessionConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setPhpSaveHandler($phpSaveHandler)
{
Expand All @@ -186,7 +187,7 @@ public function setPhpSaveHandler($phpSaveHandler)
*
* @param string $serializeHandler
* @return SessionConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setSerializeHandler($serializeHandler)
{
Expand All @@ -205,6 +206,13 @@ public function setSerializeHandler($serializeHandler)

// session.cache_limiter

/**
* Set cache limiter
*
* @param $cacheLimiter
* @return SessionConfiguration
* @throws Exception\InvalidArgumentException
*/
public function setCacheLimiter($cacheLimiter)
{
$cacheLimiter = (string) $cacheLimiter;
Expand Down Expand Up @@ -239,7 +247,7 @@ protected function getHashFunctions()
*
* @param string|int $hashFunction
* @return SessionConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setHashFunction($hashFunction)
{
Expand All @@ -259,7 +267,7 @@ public function setHashFunction($hashFunction)
*
* @param int $hashBitsPerCharacter
* @return SessionConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setHashBitsPerCharacter($hashBitsPerCharacter)
{
Expand Down
32 changes: 16 additions & 16 deletions src/Configuration/StandardConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace Zend\Session\Configuration;

use Zend\Session\Configuration as Configurable,
use Zend\Session\Configuration\ConfigurationInterface as Configurable,
Zend\Session\Exception,
Zend\Validator\Hostname as HostnameValidator,
Zend\Filter\Word\CamelCaseToUnderscore as CamelCaseToUnderscoreFilter;
Expand Down Expand Up @@ -99,7 +99,7 @@ class StandardConfiguration implements Configurable
*
* @param string $storageName
* @param mixed $storageValue
* @return Zend\Session\Configuration\StandardConfiguration
* @return StandardConfiguration
*/
public function setStorageOption($storageName, $storageValue)
{
Expand All @@ -123,7 +123,7 @@ public function getStorageOption($storageOption)
*
* @param string $savePath
* @return StandardConfiguration
* @throws SessionException on invalid path
* @throws Exception\InvalidArgumentException on invalid path
*/
public function setSavePath($savePath)
{
Expand Down Expand Up @@ -153,7 +153,7 @@ public function getSavePath()
*
* @param string $name
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setName($name)
{
Expand Down Expand Up @@ -183,7 +183,7 @@ public function getName()
*
* @param int $gcProbability
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setGcProbability($gcProbability)
{
Expand All @@ -204,7 +204,7 @@ public function setGcProbability($gcProbability)
*
* @param int $gcDivisor
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setGcDivisor($gcDivisor)
{
Expand All @@ -225,7 +225,7 @@ public function setGcDivisor($gcDivisor)
*
* @param int $gcMaxlifetime
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setGcMaxlifetime($gcMaxlifetime)
{
Expand All @@ -248,7 +248,7 @@ public function setGcMaxlifetime($gcMaxlifetime)
*
* @param int $cookieLifetime
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setCookieLifetime($cookieLifetime)
{
Expand Down Expand Up @@ -282,7 +282,7 @@ public function getCookieLifetime()
*
* @param string $cookiePath
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setCookiePath($cookiePath)
{
Expand Down Expand Up @@ -316,7 +316,7 @@ public function getCookiePath()
*
* @param string $cookieDomain
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setCookieDomain($cookieDomain)
{
Expand Down Expand Up @@ -434,7 +434,7 @@ public function getUseCookies()
*
* @param string $entropyFile
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setEntropyFile($entropyFile)
{
Expand All @@ -451,7 +451,7 @@ public function setEntropyFile($entropyFile)
*
* @param int $entropyLength
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setEntropyLength($entropyLength)
{
Expand All @@ -472,7 +472,7 @@ public function setEntropyLength($entropyLength)
*
* @param int $cacheExpire
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setCacheExpire($cacheExpire)
{
Expand All @@ -495,7 +495,7 @@ public function setCacheExpire($cacheExpire)
*
* @param int $hashBitsPerCharacter
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setHashBitsPerCharacter($hashBitsPerCharacter)
{
Expand All @@ -513,7 +513,7 @@ public function setHashBitsPerCharacter($hashBitsPerCharacter)
*
* @param int $rememberMeSeconds
* @return StandardConfiguration
* @throws SessionException
* @throws Exception\InvalidArgumentException
*/
public function setRememberMeSeconds($rememberMeSeconds)
{
Expand Down Expand Up @@ -660,7 +660,7 @@ public function toArray()
* @param string $method
* @param array $args
* @return mixed
* @throws BadMethodCallException on non-getter/setter method
* @throws Exception\BadMethodCallException on non-getter/setter method
*/
public function __call($method, $args)
{
Expand Down
25 changes: 14 additions & 11 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@

namespace Zend\Session;

use ArrayObject;
use ArrayObject,
Iterator,
Zend\Session\ManagerInterface as Manager,
Zend\Session\Storage\StorageInterface as Storage;

/**
* Session storage container
Expand Down Expand Up @@ -53,14 +56,14 @@ class Container extends ArrayObject
protected static $managerDefaultClass = 'Zend\\Session\\SessionManager';

/**
* @var Manager Default manager to use when instantiating a container without providing a Manager
* @var Manager Default manager to use when instantiating a container without providing a ManagerInterface
*/
protected static $defaultManager;

/**
* Constructor
*
* Provide a name ('Default' if none provided) and a Manager instance.
* Provide a name ('Default' if none provided) and a ManagerInterface instance.
*
* @param null|string $name
* @param Manager $manager
Expand All @@ -82,7 +85,7 @@ public function __construct($name = 'Default', Manager $manager = null)
}

/**
* Set the default Manager instance to use when none provided to constructor
* Set the default ManagerInterface instance to use when none provided to constructor
*
* @param Manager $manager
* @return void
Expand All @@ -93,19 +96,19 @@ public static function setDefaultManager(Manager $manager = null)
}

/**
* Get the default Manager instance
* Get the default ManagerInterface instance
*
* If none provided, instantiates one of type {@link $managerDefaultClass}
*
* @return Manager
* @throws Exception if invalid manager default class provided
* @throws Exception\InvalidArgumentException if invalid manager default class provided
*/
public static function getDefaultManager()
{
if (null === self::$defaultManager) {
$manager = new self::$managerDefaultClass();
if (!$manager instanceof Manager) {
throw new Exception\InvalidArgumentException('Invalid default manager type provided; must implement Manager');
throw new Exception\InvalidArgumentException('Invalid default manager type provided; must implement ManagerInterface');
}
self::$defaultManager = $manager;
}
Expand Down Expand Up @@ -143,7 +146,7 @@ protected function setManager(Manager $manager = null)
if (null === $manager) {
$manager = self::getDefaultManager();
if (!$manager instanceof Manager) {
throw new Exception\InvalidArgumentException('Manager provided is invalid; must implement Manager interface');
throw new Exception\InvalidArgumentException('Manager provided is invalid; must implement ManagerInterface interface');
}
}
$this->manager = $manager;
Expand All @@ -153,7 +156,7 @@ protected function setManager(Manager $manager = null)
/**
* Get session storage object
*
* Proxies to Manager::getStorage()
* Proxies to ManagerInterface::getStorage()
*
* @return Storage
*/
Expand Down Expand Up @@ -182,7 +185,7 @@ protected function createContainer()
*
* @param bool $createContainer Whether or not to create the container for the namespace
* @return Storage|null Returns null only if $createContainer is false
* @throws Exception
* @throws Exception\RuntimeException
*/
protected function verifyNamespace($createContainer = true)
{
Expand Down Expand Up @@ -516,7 +519,7 @@ public function setExpirationHops($hops, $vars = null)
// Cannot pass "$this" to a lambda
$container = $this;

// Filter out any items not in our container
// FilterInterface out any items not in our container
$expires = array_filter($vars, function ($value) use ($container) {
return $container->offsetExists($value);
});
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

class BadMethodCallException
extends \BadMethodCallException
implements \Zend\Session\Exception
implements ExceptionInterface
{}
5 changes: 2 additions & 3 deletions src/Exception.php → src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,17 @@
* @since Preview Release 0.2
*/

namespace Zend\Session;
namespace Zend\Session\Exception;

/**
* Zend_Session_Exception
*
* @uses Zend\Exception
* @category Zend
* @package Zend_Session
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Exception
interface ExceptionInterface
{
/**
* sessionStartError
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

class InvalidArgumentException
extends \InvalidArgumentException
implements \Zend\Session\Exception
implements ExceptionInterface
{}
2 changes: 1 addition & 1 deletion src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

class RuntimeException
extends \RuntimeException
implements \Zend\Session\Exception
implements ExceptionInterface
{}
Loading

0 comments on commit e07e054

Please sign in to comment.