%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php
namespace mdm\converter;
/**
* SerializeConverter
*
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @since 1.0
*/
class SerializeConverter extends BaseConverter
{
/**
* @var array function to serialize and unserialize data
*/
public $serialize;
/**
* @var string
*/
public $format = 'serialize';
/**
* @var array
*/
public $serializeParams = [];
/**
* @var array
*/
public $unserializeParams = [];
/**
* @var array serialize function
*/
private $_serializes = [
'serialize' => ['serialize', 'unserialize'],
'json' => ['json_encode', 'json_decode'],
];
/**
* @inheritdoc
*/
public function init()
{
if ($this->serialize === null) {
$this->serialize = $this->_serializes[$this->format];
}
}
/**
* @inheritdoc
*/
protected function convertToLogical($value, $attribute)
{
$params = $this->unserializeParams;
array_unshift($params, $value);
return call_user_func_array($this->serialize[1], $params);
}
/**
* @inheritdoc
*/
protected function convertToPhysical($value, $attribute)
{
$params = $this->serializeParams;
array_unshift($params, $value);
return call_user_func_array($this->serialize[0], $params);
}
}