13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Serializer |
16 * @package Zend_Serializer |
17 * @subpackage Adapter |
17 * @subpackage Adapter |
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @version $Id: PhpCode.php 20574 2010-01-24 17:39:14Z mabe $ |
20 * @version $Id: PhpCode.php 24593 2012-01-05 20:35:02Z matthew $ |
21 */ |
21 */ |
22 |
22 |
23 /** @see Zend_Serializer_Adapter_AdapterAbstract */ |
23 /** @see Zend_Serializer_Adapter_AdapterAbstract */ |
24 require_once 'Zend/Serializer/Adapter/AdapterAbstract.php'; |
24 require_once 'Zend/Serializer/Adapter/AdapterAbstract.php'; |
25 |
25 |
26 /** |
26 /** |
27 * @category Zend |
27 * @category Zend |
28 * @package Zend_Serializer |
28 * @package Zend_Serializer |
29 * @subpackage Adapter |
29 * @subpackage Adapter |
30 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
30 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
31 * @license http://framework.zend.com/license/new-bsd New BSD License |
31 * @license http://framework.zend.com/license/new-bsd New BSD License |
32 */ |
32 */ |
33 class Zend_Serializer_Adapter_PhpCode extends Zend_Serializer_Adapter_AdapterAbstract |
33 class Zend_Serializer_Adapter_PhpCode extends Zend_Serializer_Adapter_AdapterAbstract |
34 { |
34 { |
35 /** |
35 /** |
36 * Serialize PHP using var_export |
36 * Serialize PHP using var_export |
37 * |
37 * |
38 * @param mixed $value |
38 * @param mixed $value |
39 * @param array $opts |
39 * @param array $opts |
40 * @return string |
40 * @return string |
41 */ |
41 */ |
42 public function serialize($value, array $opts = array()) |
42 public function serialize($value, array $opts = array()) |
43 { |
43 { |
44 return var_export($value, true); |
44 return var_export($value, true); |
46 |
46 |
47 /** |
47 /** |
48 * Deserialize PHP string |
48 * Deserialize PHP string |
49 * |
49 * |
50 * Warning: this uses eval(), and should likely be avoided. |
50 * Warning: this uses eval(), and should likely be avoided. |
51 * |
51 * |
52 * @param string $code |
52 * @param string $code |
53 * @param array $opts |
53 * @param array $opts |
54 * @return mixed |
54 * @return mixed |
55 * @throws Zend_Serializer_Exception on eval error |
55 * @throws Zend_Serializer_Exception on eval error |
56 */ |
56 */ |
57 public function unserialize($code, array $opts = array()) |
57 public function unserialize($code, array $opts = array()) |
58 { |
58 { |