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

Commit

Permalink
Merge branch 'cs/various-things' of https://github.com/Maks3w/zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 67 deletions.
6 changes: 3 additions & 3 deletions src/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function setOptions($options)
* @param mixed $value Option value
* @return AbstractAdapter
*/
public function setOption($name, $value)
public function setOption($name, $value)
{
$this->_options[(string) $name] = $value;
return $this;
Expand All @@ -77,7 +77,7 @@ public function setOption($name, $value)
*
* @return array
*/
public function getOptions()
public function getOptions()
{
return $this->_options;
}
Expand All @@ -89,7 +89,7 @@ public function getOptions()
* @return mixed
* @throws InvalidArgumentException
*/
public function getOption($name)
public function getOption($name)
{
$name = (string) $name;
if (!array_key_exists($name, $this->_options)) {
Expand Down
12 changes: 6 additions & 6 deletions src/Adapter/Amf0.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Amf0 extends AbstractAdapter
{
/**
* Serialize a PHP value to AMF0 format
*
* @param mixed $value
* @param array $opts
*
* @param mixed $value
* @param array $opts
* @return string
* @throws RuntimeException
*/
Expand All @@ -42,9 +42,9 @@ public function serialize($value, array $opts = array())

/**
* Unserialize an AMF0 value to PHP
*
* @param mixed $value
* @param array $opts
*
* @param mixed $value
* @param array $opts
* @return void
* @throws RuntimeException
*/
Expand Down
12 changes: 6 additions & 6 deletions src/Adapter/Amf3.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Amf3 extends AbstractAdapter
{
/**
* Serialize a PHP value to AMF3 format
*
* @param mixed $value
* @param array $opts
*
* @param mixed $value
* @param array $opts
* @return string
* @throws RuntimeException
*/
Expand All @@ -42,9 +42,9 @@ public function serialize($value, array $opts = array())

/**
* Deserialize an AMF3 value to PHP
*
* @param mixed $value
* @param array $opts
*
* @param mixed $value
* @param array $opts
* @return string
* @throws RuntimeException
*/
Expand Down
14 changes: 7 additions & 7 deletions src/Adapter/IgBinary.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class IgBinary extends AbstractAdapter

/**
* Constructor
*
*
* @param array|\Traversable $options
* @return void
* @throws ExtensionNotLoadedException If igbinary extension is not present
Expand All @@ -47,9 +47,9 @@ public function __construct($options = array())

/**
* Serialize PHP value to igbinary
*
* @param mixed $value
* @param array $opts
*
* @param mixed $value
* @param array $opts
* @return string
* @throws RuntimeException on igbinary error
*/
Expand All @@ -65,9 +65,9 @@ public function serialize($value, array $opts = array())

/**
* Deserialize igbinary string to PHP value
*
* @param string|binary $serialized
* @param array $opts
*
* @param string|binary $serialized
* @param array $opts
* @return mixed
* @throws RuntimeException on igbinary error
*/
Expand Down
12 changes: 6 additions & 6 deletions src/Adapter/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class Json extends AbstractAdapter

/**
* Serialize PHP value to JSON
*
* @param mixed $value
* @param array $opts
*
* @param mixed $value
* @param array $opts
* @return string
* @throws InvalidArgumentException|RuntimeException on JSON encoding exception
*/
Expand All @@ -53,9 +53,9 @@ public function serialize($value, array $opts = array())

/**
* Deserialize JSON to PHP value
*
* @param string $json
* @param array $opts
*
* @param string $json
* @param array $opts
* @return mixed
* @throws InvalidArgumentException|RuntimeException
*/
Expand Down
12 changes: 6 additions & 6 deletions src/Adapter/PhpCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class PhpCode extends AbstractAdapter
{
/**
* Serialize PHP using var_export
*
* @param mixed $value
* @param array $opts
*
* @param mixed $value
* @param array $opts
* @return string
*/
public function serialize($value, array $opts = array())
Expand All @@ -35,9 +35,9 @@ public function serialize($value, array $opts = array())
* Deserialize PHP string
*
* Warning: this uses eval(), and should likely be avoided.
*
* @param string $code
* @param array $opts
*
* @param string $code
* @param array $opts
* @return mixed
* @throws RuntimeException on eval error
*/
Expand Down
16 changes: 8 additions & 8 deletions src/Adapter/PhpSerialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PhpSerialize extends AbstractAdapter

/**
* Constructor
*
*
* @param array|\Traversable $options
* @return void
*/
Expand All @@ -43,9 +43,9 @@ public function __construct($options = array())

/**
* Serialize using serialize()
*
* @param mixed $value
* @param array $opts
*
* @param mixed $value
* @param array $opts
* @return string
* @throws RuntimeException On serialize error
*/
Expand All @@ -67,10 +67,10 @@ public function serialize($value, array $opts = array())

/**
* Unserialize
*
*
* @todo Allow integration with unserialize_callback_func
* @param string $serialized
* @param array $opts
* @param string $serialized
* @param array $opts
* @return mixed
* @throws RuntimeException on unserialize error
*/
Expand All @@ -89,7 +89,7 @@ public function unserialize($serialized, array $opts = array())
return $serialized;
}

// If we have a serialized boolean false value, just return false;
// If we have a serialized boolean false value, just return false;
// prevents the unserialize handler from creating an error.
if ($serialized === self::$serializedFalse) {
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/Adapter/PythonPickle.php
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,8 @@ protected function _loadTuple2()
*
* @return void
*/
protected function _loadTuple3() {
protected function _loadTuple3()
{
$value3 = array_pop($this->_stack);
$value2 = array_pop($this->_stack);
$value1 = array_pop($this->_stack);
Expand Down
14 changes: 7 additions & 7 deletions src/Adapter/Wddx.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Wddx extends AbstractAdapter

/**
* Constructor
*
*
* @param array $options
* @return void
* @throws ExtensionNotLoadedException if wddx extension not found
Expand All @@ -47,9 +47,9 @@ public function __construct($options = array())

/**
* Serialize PHP to WDDX
*
* @param mixed $value
* @param array $opts
*
* @param mixed $value
* @param array $opts
* @return string
* @throws RuntimeException on wddx error
*/
Expand All @@ -72,9 +72,9 @@ public function serialize($value, array $opts = array())

/**
* Unserialize from WDDX to PHP
*
* @param string $wddx
* @param array $opts
*
* @param string $wddx
* @param array $opts
* @return mixed
* @throws RuntimeException on wddx error
*/
Expand Down
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 serializer adapters.
*
* Enforces that adapters retrieved are instances of
* Adapter\AdapterInterface. Additionally, it registers a number of default
* 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 @@ -45,8 +45,8 @@ class AdapterPluginManager extends AbstractPluginManager
*
* Checks that the adapter loaded is an instance
* of Adapter\AdapterInterface.
*
* @param mixed $plugin
*
* @param mixed $plugin
* @return void
* @throws Exception\RuntimeException if invalid
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
* @category Zend
* @package Zend_Serializer
*/
class InvalidArgumentException extends \InvalidArgumentException implements
class InvalidArgumentException extends \InvalidArgumentException implements
ExceptionInterface
{}
18 changes: 9 additions & 9 deletions src/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Serializer
* @param array |\Traversable $opts Serializer options
* @return Adapter
*/
public static function factory($adapterName, $opts = array())
public static function factory($adapterName, $opts = array())
{
if ($adapterName instanceof Adapter) {
return $adapterName; // $adapterName is already an adapter object
Expand All @@ -53,7 +53,7 @@ public static function factory($adapterName, $opts = array())
*
* @return AdapterPluginManager
*/
public static function getAdapterPluginManager()
public static function getAdapterPluginManager()
{
if (self::$_adapters === null) {
self::$_adapters = self::_getDefaultAdapterPluginManager();
Expand All @@ -67,11 +67,11 @@ public static function getAdapterPluginManager()
* @param AdapterPluginManager $adapters
* @return void
*/
public static function setAdapterPluginManager(AdapterPluginManager $adapters)
public static function setAdapterPluginManager(AdapterPluginManager $adapters)
{
self::$_adapters = $adapters;
}

/**
* Resets the internal adapter plugin manager
*
Expand All @@ -82,7 +82,7 @@ public static function resetAdapterPluginManager()
self::$_adapters = self::_getDefaultAdapterPluginManager();
return self::$_adapters;
}

/**
* Returns a default adapter plugin manager
*
Expand All @@ -100,7 +100,7 @@ protected static function _getDefaultAdapterPluginManager()
* @param string|Adapter $adapter
* @param array|\Traversable $options
*/
public static function setDefaultAdapter($adapter, $options = array())
public static function setDefaultAdapter($adapter, $options = array())
{
self::$_defaultAdapter = self::factory($adapter, $options);
}
Expand All @@ -110,7 +110,7 @@ public static function setDefaultAdapter($adapter, $options = array())
*
* @return Adapter
*/
public static function getDefaultAdapter()
public static function getDefaultAdapter()
{
if (!self::$_defaultAdapter instanceof Adapter) {
self::setDefaultAdapter(self::$_defaultAdapter);
Expand All @@ -125,7 +125,7 @@ public static function getDefaultAdapter()
* @param array $options
* @return string
*/
public static function serialize($value, array $options = array())
public static function serialize($value, array $options = array())
{
if (isset($options['adapter'])) {
$adapter = self::factory($options['adapter']);
Expand All @@ -144,7 +144,7 @@ public static function serialize($value, array $options = array())
* @param array $options
* @return mixed
*/
public static function unserialize($serialized, array $options = array())
public static function unserialize($serialized, array $options = array())
{
if (isset($options['adapter'])) {
$adapter = self::factory($options['adapter']);
Expand Down
3 changes: 2 additions & 1 deletion test/Adapter/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public function testUnserializeFalse()
$this->assertEquals($expected, $data);
}

public function testUnserializeNull() {
public function testUnserializeNull()
{
$value = 'null';
$expected = null;

Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/PhpCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function testUnserializeObject()
public function testUnserializeInvalid()
{
$value = 'not a serialized string';

$this->setExpectedException('Zend\Serializer\Exception\RuntimeException', 'eval failed: syntax error');
$this->_adapter->unserialize($value);
}
Expand Down
2 changes: 1 addition & 1 deletion test/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testFactoryUnknownAdapter()
$this->setExpectedException('Zend\ServiceManager\Exception\ServiceNotFoundException');
Serializer::factory('unknown');
}

public function testFactoryOnADummyClassAdapter()
{
$adapters = new AdapterPluginManager();
Expand Down

0 comments on commit c386fb6

Please sign in to comment.