1 | <?php |
||
50 | class SmallText extends Type implements TypeInterface |
||
51 | { |
||
52 | /** |
||
53 | * The value of the string. |
||
54 | * |
||
55 | * @var string |
||
56 | * |
||
57 | * @since 1.0 |
||
58 | */ |
||
59 | private $value; |
||
60 | |||
61 | /** |
||
62 | * The validation rule for the string type. |
||
63 | * |
||
64 | * @var string |
||
65 | * |
||
66 | * @since 1.0 |
||
67 | */ |
||
68 | private $validationRule; |
||
69 | |||
70 | /** |
||
71 | * The error message for the string type when validation fails. |
||
72 | * |
||
73 | * @var string |
||
74 | * |
||
75 | * @since 1.0 |
||
76 | */ |
||
77 | protected $helper = 'Not a valid smalltext value!'; |
||
78 | |||
79 | /** |
||
80 | * The size of the value for the this String. |
||
81 | * |
||
82 | * @var int |
||
83 | * |
||
84 | * @since 1.0 |
||
85 | */ |
||
86 | private $size = 255; |
||
87 | |||
88 | /** |
||
89 | * The absolute maximum size of the value for the this String. |
||
90 | * |
||
91 | * @var int |
||
92 | * |
||
93 | * @since 1.0 |
||
94 | */ |
||
95 | const MAX_SIZE = 255; |
||
96 | |||
97 | /** |
||
98 | * Simple boolean to determine if the string is a password or not. |
||
99 | * |
||
100 | * @var bool |
||
101 | * |
||
102 | * @since 1.0 |
||
103 | */ |
||
104 | private $password = false; |
||
105 | |||
106 | /** |
||
107 | * Constructor. |
||
108 | * |
||
109 | * @param string $val |
||
110 | * |
||
111 | * @since 1.0 |
||
112 | * |
||
113 | * @throws Alpha\Exception\IllegalArguementException |
||
114 | */ |
||
115 | public function __construct($val = '') |
||
129 | |||
130 | /** |
||
131 | * Setter for the value. |
||
132 | * |
||
133 | * @param string $val |
||
134 | * |
||
135 | * @since 1.0 |
||
136 | * |
||
137 | * @throws Alpha\Exception\IllegalArguementException |
||
138 | */ |
||
139 | public function setValue($val) |
||
151 | |||
152 | /** |
||
153 | * Getter for the value. |
||
154 | * |
||
155 | * @return string |
||
156 | * |
||
157 | * @since 1.0 |
||
158 | */ |
||
159 | public function getValue() |
||
163 | |||
164 | /** |
||
165 | * Setter to override the default validation rule. |
||
166 | * |
||
167 | * @param string $rule |
||
168 | * |
||
169 | * @since 1.0 |
||
170 | */ |
||
171 | public function setRule($rule) |
||
175 | |||
176 | /** |
||
177 | * Get the validation rule. |
||
178 | * |
||
179 | * @return string |
||
180 | * |
||
181 | * @since 1.0 |
||
182 | */ |
||
183 | public function getRule() |
||
187 | |||
188 | /** |
||
189 | * Used to set the allowable size of the String in the database field. |
||
190 | * |
||
191 | * @param int $size |
||
192 | * |
||
193 | * @since 1.0 |
||
194 | * |
||
195 | * @throws Alpha\Exception\IllegalArguementException |
||
196 | */ |
||
197 | public function setSize($size) |
||
205 | |||
206 | /** |
||
207 | * Get the allowable size of the Double in the database field. |
||
208 | * |
||
209 | * @return int |
||
210 | * |
||
211 | * @since 1.0 |
||
212 | */ |
||
213 | public function getSize() |
||
217 | |||
218 | /** |
||
219 | * Sets up an appropriate validation rule for a required field. |
||
220 | * |
||
221 | * @param bool $req |
||
222 | * |
||
223 | * @since 1.0 |
||
224 | */ |
||
225 | public function isRequired($req = true) |
||
232 | |||
233 | /** |
||
234 | * Define the string as a password (making it required by validation rule). |
||
235 | * |
||
236 | * @param bool $pass |
||
237 | * |
||
238 | * @since 1.0 |
||
239 | */ |
||
240 | public function isPassword($pass = true) |
||
249 | |||
250 | /** |
||
251 | * Checks to see if the string is a password or not. |
||
252 | * |
||
253 | * @return bool |
||
254 | * |
||
255 | * @since 1.0 |
||
256 | */ |
||
257 | public function checkIsPassword() |
||
261 | } |
||
262 |