Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add serializer better inheritance and extension #2808

Closed
wants to merge 1 commit into from

2 participants

@blanchonvincent

Usage with static instead of self

@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/2808'
Close #2808
17351ee
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/2808' into develop
Forward port #2808
4467123
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-serializer
@weierophinney weierophinney Merge branch 'hotfix/2808' 43e5dd5
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-serializer
@weierophinney weierophinney Merge branch 'hotfix/2808' into develop e848062
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 20, 2012
  1. @blanchonvincent

    Add serializer better inheritance and extension

    blanchonvincent authored
    Usage with static instead of self
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 15 deletions.
  1. +15 −15 library/Zend/Serializer/Serializer.php
View
30 library/Zend/Serializer/Serializer.php
@@ -45,7 +45,7 @@ public static function factory($adapterName, $adapterOptions = null)
return $adapterName; // $adapterName is already an adapter object
}
- return self::getAdapterPluginManager()->get($adapterName, $adapterOptions);
+ return static::getAdapterPluginManager()->get($adapterName, $adapterOptions);
}
/**
@@ -56,7 +56,7 @@ public static function factory($adapterName, $adapterOptions = null)
*/
public static function setAdapterPluginManager(AdapterPluginManager $adapters)
{
- self::$adapters = $adapters;
+ static::$adapters = $adapters;
}
/**
@@ -66,10 +66,10 @@ public static function setAdapterPluginManager(AdapterPluginManager $adapters)
*/
public static function getAdapterPluginManager()
{
- if (self::$adapters === null) {
- self::$adapters = new AdapterPluginManager();
+ if (static::$adapters === null) {
+ static::$adapters = new AdapterPluginManager();
}
- return self::$adapters;
+ return static::$adapters;
}
/**
@@ -79,8 +79,8 @@ public static function getAdapterPluginManager()
*/
public static function resetAdapterPluginManager()
{
- self::$adapters = new AdapterPluginManager();
- return self::$adapters;
+ static::$adapters = new AdapterPluginManager();
+ return static::$adapters;
}
/**
@@ -91,7 +91,7 @@ public static function resetAdapterPluginManager()
*/
public static function setDefaultAdapter($adapter, $adapterOptions = null)
{
- self::$defaultAdapter = self::factory($adapter, $adapterOptions);
+ static::$defaultAdapter = static::factory($adapter, $adapterOptions);
}
/**
@@ -101,10 +101,10 @@ public static function setDefaultAdapter($adapter, $adapterOptions = null)
*/
public static function getDefaultAdapter()
{
- if (!self::$defaultAdapter instanceof Adapter) {
- self::setDefaultAdapter(self::$defaultAdapter);
+ if (!static::$defaultAdapter instanceof Adapter) {
+ static::setDefaultAdapter(static::$defaultAdapter);
}
- return self::$defaultAdapter;
+ return static::$defaultAdapter;
}
/**
@@ -120,9 +120,9 @@ public static function getDefaultAdapter()
public static function serialize($value, $adapter = null, $adapterOptions = null)
{
if ($adapter !== null) {
- $adapter = self::factory($adapter, $adapterOptions);
+ $adapter = static::factory($adapter, $adapterOptions);
} else {
- $adapter = self::getDefaultAdapter();
+ $adapter = static::getDefaultAdapter();
}
return $adapter->serialize($value);
@@ -141,9 +141,9 @@ public static function serialize($value, $adapter = null, $adapterOptions = null
public static function unserialize($serialized, $adapter = null, $adapterOptions = null)
{
if ($adapter !== null) {
- $adapter = self::factory($adapter, $adapterOptions);
+ $adapter = static::factory($adapter, $adapterOptions);
} else {
- $adapter = self::getDefaultAdapter();
+ $adapter = static::getDefaultAdapter();
}
return $adapter->unserialize($serialized);
Something went wrong with that request. Please try again.