Esempio n. 1
0
 public function field($field, $value = null)
 {
     if (!array_key_exists($field, $this->_data)) {
         return null;
     }
     $value = parent::field($field, $value);
     return $value;
 }
Esempio n. 2
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');
     }
 }