Skip to content

Commit

Permalink
Merge pull request #34 from Schlue/FRAMEWORK_6_0
Browse files Browse the repository at this point in the history
removed duplicate __serialize and __unserialize
  • Loading branch information
ralflang authored Apr 4, 2024
2 parents 3939264 + ec9497a commit 98a4ba5
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 289 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.cache
.project
.settings
.vscode
nbproject/
*~
.#*
Expand Down
24 changes: 0 additions & 24 deletions lib/Horde/Imap/Client/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,30 +402,6 @@ public function __unserialize(array $data)
$this->_initOb();
}

/**
* @return array
*/
public function __serialize()
{
return array(
'i' => $this->_init,
'p' => $this->_params,
'v' => self::VERSION
);
}

public function __unserialize(array $data)
{
if (empty($data['v']) || $data['v'] != self::VERSION) {
throw new Exception('Cache version change');
}

$this->_init = $data['i'];
$this->_params = $data['p'];

$this->_initOb();
}

/**
*/
public function __get($name)
Expand Down
17 changes: 1 addition & 16 deletions lib/Horde/Imap/Client/Data/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,22 +170,7 @@ public function unserialize($data)
$this->__unserialize($data);
}

/**
* @return array
*/
public function __serialize()
{
return array(
'rights' => $this->_rights
);
}

public function __unserialize(array $data)
{
$this->_rights = $data['rights'];
}

/**
/**
* @return array
*/
public function __serialize()
Expand Down
13 changes: 0 additions & 13 deletions lib/Horde/Imap/Client/Data/AclRights.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,6 @@ public function unserialize($data)
$this->__unserialize($data);
}

/**
* @return array
*/
public function __serialize()
{
return [$this->_required, $this->_optional];
}

public function __unserialize(array $data)
{
list($this->_required, $this->_optional) = $data;
}

/**
* @return array
*/
Expand Down
15 changes: 1 addition & 14 deletions lib/Horde/Imap/Client/Data/Capability.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,20 +215,7 @@ public function unserialize($data)
if (!is_array($data)) {
throw new Exception('Cache version change.');
}
$this->__unserialize();
}

/**
* @return array
*/
public function __serialize()
{
return $this->_data;
}

public function __unserialize(array $data)
{
$this->_data = $data;
$this->__unserialize($data);
}

/**
Expand Down
20 changes: 0 additions & 20 deletions lib/Horde/Imap/Client/Data/Envelope.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,24 +235,4 @@ public function __unserialize(array $data)
$this->_data = $data['d'];
}

/**
* @return array
*/
public function __serialize()
{
return array(
'd' => $this->_data,
'v' => self::VERSION,
);
}

public function __unserialize(array $data)
{
if (empty($data['v']) || $data['v'] != self::VERSION) {
throw new Exception('Cache version change');
}

$this->_data = $data['d'];
}

}
13 changes: 0 additions & 13 deletions lib/Horde/Imap/Client/Data/Namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,4 @@ public function __unserialize(array $data)
$this->_data = $data;
}

/**
* @return array
*/
public function __serialize()
{
return $this->_data;
}

public function __unserialize(array $data)
{
$this->_data = $data;
}

}
13 changes: 0 additions & 13 deletions lib/Horde/Imap/Client/Data/SearchCharset.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,4 @@ public function __unserialize(array $data)
$this->_charsets = $data;
}

/**
* @return array
*/
public function __serialize()
{
return $this->_charsets;
}

public function __unserialize(array $data)
{
$this->_charsets = $data;
}

}
13 changes: 0 additions & 13 deletions lib/Horde/Imap/Client/Data/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,6 @@ public function unserialize($data)
$this->__unserialize($data);
}

/**
* @return array
*/
public function __serialize()
{
return [$this->_thread, $this->_type];
}

public function __unserialize(array $data)
{
list($this->_thread, $this->_type) = $data;
}

/**
* @return array
*/
Expand Down
58 changes: 0 additions & 58 deletions lib/Horde/Imap/Client/Ids.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,64 +450,6 @@ public function unserialize($data)
$this->__unserialize($data);
}

/**
*/
public function __serialize()
{
$save = array();

if ($this->duplicates) {
$save['d'] = 1;
}

if ($this->_sequence) {
$save['s'] = 1;
}

if ($this->_sorted) {
$save['is'] = 1;
}

switch ($this->_ids) {
case self::ALL:
$save['a'] = true;
break;

case self::LARGEST:
$save['l'] = true;
break;

case self::SEARCH_RES:
$save['sr'] = true;
break;

default:
$save['i'] = strval($this);
break;
}

return $save;
}

/**
*/
public function __unserialize($data)
{
$this->duplicates = !empty($data['d']);
$this->_sequence = !empty($data['s']);
$this->_sorted = !empty($data['is']);

if (isset($data['a'])) {
$this->_ids = self::ALL;
} elseif (isset($data['l'])) {
$this->_ids = self::LARGEST;
} elseif (isset($data['sr'])) {
$this->_ids = self::SEARCH_RES;
} elseif (isset($data['i'])) {
$this->add($data['i']);
}
}

/**
* @return array
*/
Expand Down
25 changes: 0 additions & 25 deletions lib/Horde/Imap/Client/Ids/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,31 +228,6 @@ public function unserialize($data)
$this->__unserialize($data);
}

/**
*/
public function __serialize()
{
/* Sort before storing; provides more compressible representation. */
$this->sort();

return [
strval(new Horde_Imap_Client_Ids(array_keys($this->_ids))),
strval(new Horde_Imap_Client_Ids(array_values($this->_ids)))
];
}

/**
*/
public function __unserialize($data)
{
$keys = new Horde_Imap_Client_Ids($data[0]);
$vals = new Horde_Imap_Client_Ids($data[1]);
$this->_ids = array_combine($keys->ids, $vals->ids);

/* Guaranteed to be sorted if unserializing. */
$this->_sorted = true;
}

/**
* @return array
*/
Expand Down
13 changes: 0 additions & 13 deletions lib/Horde/Imap/Client/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,6 @@ public function unserialize($data)
$this->__unserialize($data);
}

/**
* @return array
*/
public function __serialize()
{
return [$this->_utf7imap, $this->_utf8];
}

public function __unserialize(array $data)
{
list($this->_utf7imap, $this->_utf8) = $data;
}

/**
* @return array
*/
Expand Down
41 changes: 0 additions & 41 deletions lib/Horde/Imap/Client/Search/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -874,47 +874,6 @@ public function unserialize($data)
$this->__unserialize($data);
}

/**
* Serialization.
*
* @return string Serialized data.
*/
public function __serialize()
{
$data = array(
// Serialized data ID.
self::VERSION,
$this->_search
);

if (!is_null($this->_charset)) {
$data[] = $this->_charset;
}

return $data;
}

/**
* Unserialization.
*
* @param string $data Serialized data.
*
* @throws Exception
*/
public function __unserialize($data)
{
if (!is_array($data) ||
!isset($data[0]) ||
($data[0] != self::VERSION)) {
throw new Exception('Cache version change');
}

$this->_search = $data[1];
if (isset($data[2])) {
$this->_charset = $data[2];
}
}

/**
* @return array
*/
Expand Down
13 changes: 0 additions & 13 deletions lib/Horde/Imap/Client/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,19 +303,6 @@ public function unserialize($data)
$this->__unserialize($data);
}

/**
* @return array
*/
public function __serialize()
{
return array((string)$this);
}

public function __unserialize(array $data)
{
$this->_parse($data[0]);
}

/**
* @return array
*/
Expand Down
13 changes: 0 additions & 13 deletions lib/Horde/Imap/Client/Url/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,6 @@ public function unserialize($data)
$this->__unserialize($data);
}

/**
* @return array
*/
public function __serialize()
{
return array((string)$this);
}

public function __unserialize(array $data)
{
$this->_parse($data[0]);
}

/**
* @return array
*/
Expand Down

0 comments on commit 98a4ba5

Please sign in to comment.