forked from OrayDev/tudu-web
/
Cycle.php
149 lines (127 loc) · 2.63 KB
/
Cycle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
/**
* Tudu Library
*
* LICENSE
*
*
* @category Tudu
* @package Tudu_Model
* @copyright Copyright (c) 2009-2010 Shanghai Best Oray Information S&T CO., Ltd.
* @link http://www.oray.com/
* @version $Id: Tudu.php 2070 2012-08-22 09:37:26Z cutecube $
*/
/**
* @see Tudu_Dao_Manager
*/
require_once 'Tudu/Dao/Manager.php';
/**
* @category Model
* @package Model_Exception
* @copyright Copyright (c) 2009-2012 Shanghai Best Oray Information S&T CO., Ltd.
*/
class Model_Tudu_Extension_Cycle extends Model_Tudu_Extension_Abstract
{
/**
*
* @var string
*/
protected $_handlerClass = 'Model_Tudu_Extension_Handler_Cycle';
/**
*
* @var array
*/
protected $_attrs = array();
/**
* Constructor
*
* @param array $attributes
*/
public function __construct(array $attributes = null)
{
if (!empty($attributes)) {
$this->setAttributes($attributes);
}
}
/**
*
* @param string $name
*/
public function getAttribute($name)
{
$name = strtolower($name);
if (empty($this->_attrs[$name])) {
return null;
}
return $this->_attrs[$name];
}
/**
*
* @return array
*/
public function getAttributes()
{
return $this->_attrs;
}
/**
*
* @param array $attributes
*/
public function setAttributes(array $attributes)
{
foreach ($attributes as $k => $val) {
if ($k == 'steps') {
$this->_steps = $val;
continue ;
}
$this->setAttribute($k, $val);
}
return $this;
}
/**
*
* @param string $key
* @param mixed $value
* @return Model_Tudu_Extension_Flow
*/
public function setAttribute($key, $value)
{
$key = strtolower($key);
if ($key == 'steps') {
$this->_steps = $value;
return $this;
}
$this->_attrs[$key] = $value;
return $this;
}
/**
*
* @param string $name
*/
public function __get($name)
{
if ($name == 'steps') {
return $this->_steps;
}
return $this->getAttribute($name);
}
/**
*
* @param string $name
*/
public function __set($name, $value)
{
if ($name == 'steps') {
return $this->_steps = $value;
}
$this->setAttribute($name, $value);
}
/**
*
* @return string
*/
public function getHandlerClass()
{
return $this->_handlerClass;
}
}