Ejemplo n.º 1
0
 public function assign($spec, $value = null, $dohtmlspecialchars = true)
 {
     if (is_string($spec)) {
         Ensure::ensureFalse('_' == substr($spec, 0, 1), "Setting private or protected class members is not allowed");
         if ($dohtmlspecialchars) {
             $value = self::htmlspecialcharsRecursive($value);
         }
         Factory::find('Elephant\\Foundation\\View')->{$spec} = $value;
     } elseif (is_array($spec)) {
         //TODO if(is_array($val))
         foreach ($spec as $key => $val) {
             Ensure::ensureFalse('_' == substr($key, 0, 1), "Setting private or protected class members is not allowed");
             if (is_string($val)) {
                 Factory::find('Elephant\\Foundation\\View')->{$key} = $dohtmlspecialchars ? htmlspecialchars($val) : $val;
             } else {
                 if ($dohtmlspecialchars) {
                     $val = self::htmlspecialcharsRecursive($val);
                 }
                 Factory::find('Elephant\\Foundation\\View')->{$key} = $val;
             }
         }
     }
 }