示例#1
0
 public function __construct($tag_name, TagBuilderCallbacks $callback_object, $name = null)
 {
     C::guardIsString($tag_name);
     C::guardIfNotNull($name, "guardIsString");
     $this->_tag_name = $tag_name;
     $this->_callback_object = $callback_object;
     $this->_name = $name;
 }
示例#2
0
 public function content($content = 0)
 {
     if ($content === 0) {
         return $this->_content;
     }
     C::guardIfNotNull($content, "guardIsHTML");
     $this->_content = $content;
     return $this;
 }
示例#3
0
 public function __construct($function, $unwrap_args = true, $args = null, $arity = null, $reify_exceptions = null, $origin = null)
 {
     if ($origin === null) {
         if (is_string($function)) {
             $origin = $function;
         } else {
             $origin = V::ANONYMUS_FUNCTION_ORIGIN;
         }
     }
     parent::__construct($origin);
     if (is_string($function)) {
         C::guardIsCallable($function);
     } else {
         C::guardIsClosure($function);
     }
     C::guardIsBool($unwrap_args);
     $args = self::defaultTo($args, array());
     $reify_exceptions = self::defaultTo($reify_exceptions, array());
     C::guardIsArray($args);
     C::guardIfNotNull($arity, "guardIsUInt");
     C::guardIsArray($reify_exceptions);
     foreach ($args as $key => $value) {
         $args[$key] = $this->toValue($value, null);
     }
     if ($arity === null) {
         $refl = new ReflectionFunction($function);
         $this->_arity = $refl->getNumberOfParameters() - count($args);
     } else {
         $this->_arity = $arity - count($args);
     }
     if ($this->_arity < 0) {
         throw new Exception("FunctionValue::__construct: more args then parameters.");
     }
     $this->_function = $function;
     $this->_unwrap_args = $unwrap_args;
     $this->_args = $args;
     $this->_reify_exceptions = $reify_exceptions;
 }
示例#4
0
 public function __construct($origin)
 {
     C::guardIfNotNull($origin, "guardIsString");
     $this->_origin = $origin;
 }
示例#5
0
 public static function textarea($default = null, $attributes = null)
 {
     C::guardIfNotNull($default, "guardIsString");
     return self::textarea_raw($attributes)->satisfies(V::fn("is_string"), "Input is no string.")->mapHTML(V::fn(function ($dict, $html) use($default) {
         $name = $html->attribute("name");
         $value = $dict->value($name);
         if ($value === null) {
             $value = $default;
         }
         if ($value !== null) {
             $html = $html->content(H::text($value));
         }
         return $html;
     }));
 }