Ejemplo n.º 1
0
 /**
  * Returns user data value.
  * @param string property name
  * @return mixed
  */
 public function &__get($key)
 {
     if (parent::__isset($key)) {
         return parent::__get($key);
     } else {
         $data = $this->data->toArray();
         return $data[$key];
     }
 }
Ejemplo n.º 2
0
 /**
  * @param string $name
  * @return bool
  */
 public function __isset($name)
 {
     $isset = parent::__isset($name);
     if ($isset) {
         return TRUE;
     }
     $data = $this->getData();
     return isset($data[$name]);
 }
 /**
  * Is property defined?
  * @param  string  property name
  * @return bool
  */
 public function __isset($key)
 {
     return isset($this->data[$key]) || parent::__isset($key);
 }
Ejemplo n.º 4
0
 public function __unset($name)
 {
     if (parent::__isset($name)) {
         parent::__unset($name);
     } else {
         unset($this->data->{$name});
     }
 }
Ejemplo n.º 5
0
 /**
  * Magic isset to $this->data
  * @param string $name
  * @return bool
  */
 public function __isset($name)
 {
     return !parent::__isset($name) ? isset($this->data[$name]) : TRUE;
 }
Ejemplo n.º 6
0
 /**
  * Provides access to shortcuts of page elements defined using property-read
  * annotations (eg. `property-read Element $name strategy=value`).
  *
  * If there is a getter for the value (eg. method `getFoo()` for `$foo` property),
  * the getter is used instead.
  *
  * Definition of a shortcut may include the tag name and required attributes
  * values. These are checked then. Eg. `property-read Element $name
  * strategy=value, tagName, [attrib=value, another=value]`.
  *
  * Eventual comment may be separated by a space and a hash: `property-read
  * Element $name strategy=value # Now this is a comment.`
  *
  * @param string $name
  * @return mixed
  */
 public function &__get($name)
 {
     $shortcuts = $this->getShortcuts();
     if (!parent::__isset($name) && isset($shortcuts[$name])) {
         $this->checkState();
         $criteria = array('strategy' => $shortcuts[$name][0], 'selector' => $shortcuts[$name][1]);
         $expectedTagName = isset($shortcuts[$name][3]) ? $shortcuts[$name][3] : NULL;
         $expectedAttribs = isset($shortcuts[$name][4]) ? $shortcuts[$name][4] : NULL;
         if ($shortcuts[$name][2]) {
             $elements = $this->findElements($criteria['strategy'], $criteria['selector']);
             foreach ($elements as $index => $element) {
                 $shortcutDescription = get_class($this) . '::$' . $name . "[{$index}]";
                 $this->checkTagNameAndAttributes($element, $shortcutDescription, $expectedTagName, $expectedAttribs);
             }
             return $elements;
         } else {
             $element = $this->findElement($criteria['strategy'], $criteria['selector']);
             $shortcutDescription = get_class($this) . '::$' . $name;
             $this->checkTagNameAndAttributes($element, $shortcutDescription, $expectedTagName, $expectedAttribs);
             return $element;
         }
     } else {
         return parent::__get($name);
     }
 }
 /**
  * Is property defined?
  * Tries to use dynamic getter for protected properties (reflection fields).
  *
  * @param  string  property name
  * @return bool
  */
 public function __isset($name)
 {
     if (parent::__isset($name)) {
         return TRUE;
     } else {
         return $this->hasProtectedReflectionField($name);
     }
 }