1: <?php
2: /**
3: * SQL storage object for auth signup information.
4: *
5: * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
6: *
7: * See the enclosed file COPYING for license information (LGPL). If you did
8: * not receive this file, see http://opensource.org/licenses/lgpl-2.1.php
9: *
10: * @author Duck <duck@obala.net>
11: * @category Horde
12: * @license http://opensource.org/licenses/lgpl-2.1.php LGPL
13: * @package Core
14: */
15: class Horde_Core_Auth_Signup_SqlObject
16: {
17: /**
18: * Key-value hash that will be serialized.
19: *
20: * @see getData()
21: * @var array
22: */
23: protected $_data = array();
24:
25: /**
26: * The unique name of this object. These names have the same requirements
27: * as other object names - they must be unique, etc.
28: *
29: * @var string
30: */
31: protected $_name;
32:
33: /**
34: * Constructor.
35: *
36: * @param string $id The id of the signup.
37: */
38: public function __construct($id)
39: {
40: $this->_name = $id;
41: }
42:
43: /**
44: * Gets the data array.
45: *
46: * @return array The internal data array.
47: */
48: public function getData()
49: {
50: return $this->_data;
51: }
52:
53: /**
54: * Sets the data array.
55: *
56: * @param array $data The data array to store internally.
57: */
58: public function setData($data)
59: {
60: $part = unserialize($data['signup_data']);
61: if (!empty($part) && is_array($part)) {
62: if (!empty($part['extra'])) {
63: $extra = $part['extra'];
64: unset($part['extra']);
65: $part = array_merge($part, $extra);
66: }
67: $this->_data = array_merge($data, $part);
68: } else {
69: $this->_data = $data;
70: }
71:
72: unset($this->_data['signup_data']);
73:
74: if (isset($data['signup_date'])) {
75: $this->_data['dateReceived'] = $data['signup_date'];
76: }
77: }
78:
79: /**
80: * Gets the name of this object.
81: *
82: * @return string The object name.
83: */
84: public function getName()
85: {
86: return $this->_name;
87: }
88: }
89: