Author: jablko
Date: Mon Nov 16 14:19:54 2009
New Revision: 3897
Log:
Add magic methods
Modified:
trunk/lib/vendor/symfony/lib/validator/sfValidatorSchema.class.php
Modified: trunk/lib/vendor/symfony/lib/validator/sfValidatorSchema.class.php
==============================================================================
--- trunk/lib/vendor/symfony/lib/validator/sfValidatorSchema.class.php Mon Nov
16 14:01:14 2009 (r3896)
+++ trunk/lib/vendor/symfony/lib/validator/sfValidatorSchema.class.php Mon Nov
16 14:19:54 2009 (r3897)
@@ -293,11 +293,18 @@
*
* @return bool true if the schema has a field with the given name, false
otherwise
*/
- public function offsetExists($name)
+ public function __isset($name)
{
return isset($this->fields[$name]);
}
+ public function offsetExists($offset)
+ {
+ $args = func_get_args();
+
+ return call_user_func_array(array($this, '__isset'), $args);
+ }
+
/**
* Gets the field associated with the given name (implements the ArrayAccess
interface).
*
@@ -305,18 +312,25 @@
*
* @return sfValidatorBase The sfValidatorBase instance associated with the
given name, null if it does not exist
*/
- public function offsetGet($name)
+ public function __get($name)
{
return isset($this->fields[$name]) ? $this->fields[$name] : null;
}
+ public function offsetGet($offset)
+ {
+ $args = func_get_args();
+
+ return call_user_func_array(array($this, '__get'), $args);
+ }
+
/**
* Sets a field (implements the ArrayAccess interface).
*
* @param string $name The field name
* @param sfValidatorBase $validator An sfValidatorBase instance
*/
- public function offsetSet($name, $validator)
+ public function __set($name, $validator)
{
if (!$validator instanceof sfValidatorBase)
{
@@ -326,16 +340,30 @@
$this->fields[$name] = clone $validator;
}
+ public function offsetSet($offset, $value)
+ {
+ $args = func_get_args();
+
+ return call_user_func_array(array($this, '__set'), $args);
+ }
+
/**
* Removes a field by name (implements the ArrayAccess interface).
*
* @param string $name
*/
- public function offsetUnset($name)
+ public function __unset($name)
{
unset($this->fields[$name]);
}
+ public function offsetUnset($offset)
+ {
+ $args = func_get_args();
+
+ return call_user_func_array(array($this, '__unset'), $args);
+ }
+
/**
* Returns an array of fields.
*
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---