Example #1
0
 public function field($field, $value = null)
 {
     if (!array_key_exists($field, $this->_data)) {
         return null;
     }
     $value = parent::field($field, $value);
     return $value;
 }
Example #2
0
 public function __set($field, $value)
 {
     if (is_callable($value)) {
         $this->learn($field, $value);
     } else {
         parent::__set($field, $value);
     }
 }
Example #3
0
 public function __construct($config = null)
 {
     parent::__construct();
     $this->status(self::STATUS_NOTCONNECTED);
     if (is_array($config)) {
         $this->config($config);
     }
 }
Example #4
0
 public function __construct($file = null)
 {
     parent::__construct();
     $this->_parser = \xml_parser_create();
     \xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, true);
     \xml_set_object($this->_parser, $this);
     \xml_set_element_handler($this->_parser, array($this, 'startHandler'), array($this, 'endHandler'));
     \xml_set_character_data_handler($this->_parser, array($this, 'dataHandler'));
     if (DevValue::isNotNull($file)) {
         $this->file($file);
         $this->parseXML($file);
     }
 }
 /**
  * Assign an array of variables to the object properties
  *
  */
 public function assign($data)
 {
     $this->perform(State::DRAFT);
     if ($this->is(State::DRAFT) && is_array($data)) {
         $temp = array();
         foreach ($data as $a => $b) {
             $key = $this->formatAsKey($a);
             $temp[$key] = $b;
         }
         parent::assign($temp);
         $this->halt(State::DRAFT);
     }
 }
Example #6
0
 protected function init()
 {
     parent::init();
 }
Example #7
0
 public function field($var, $content = null, $formatted = null)
 {
     if ($formatted) {
         $content = HTML::format($content);
     }
     if (is_string($var)) {
         if (!$content) {
             throw new InvalidArgumentException('Cannot assign empty value.');
         }
         if (DevValue::isNotNull($formatted) && !is_bool($formatted)) {
             throw new InvalidArgumentException('Formatted argument expects boolean');
         }
         return parent::field($var, $content);
     } elseif (is_object($var) || DevArray::isAssoc($var)) {
         if (!$formatted) {
             $formatted = $content;
         }
         foreach ($var as $a => $b) {
             $this->field($a, $b, $formatted);
         }
     } else {
         throw new InvalidArgumentException('Invalid property');
     }
 }
Example #8
0
 public function __construct($config = null)
 {
     parent::__construct($config);
 }