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; }
public function __construct($reason, $origin, $others = array()) { C::guardIsString($reason); C::guardEach($others, "guardIsErrorValue"); $this->_reason = $reason; $this->_others = $others; $this->_dict = null; parent::__construct($origin); }
public final function satisfies(FunctionValue $predicate, $error) { C::guardIsString($error); C::guardHasArity($predicate, 1); return $this->map(V::fn_w(function ($value) use($predicate, $error) { if (!$predicate->apply($value)->get()) { return V::error($error, $value->origin()); } return $value; })); }
public function attribute($key, $value = null) { if ($value === null) { if (!array_key_exists($key, $this->_attributes)) { return null; } return $this->_attributes[$key]; } C::guardIsString($key); C::guardIsString($value); $this->_attributes[$key] = $value; return $this; }
public static function keysAndValuesToHTMLAttributes($attributes) { $str = ""; foreach ($attributes as $key => $value) { C::guardIsString($key); if ($value !== null) { C::guardIsString($value); } $value = str_replace('"', '"', $value); $str .= " " . $key . ($value !== null ? "=\"{$value}\"" : ""); } return $str; }
public function __construct($id, $action, $attrs, IFormlet $formlet) { if (!preg_match("#[a-zA-Z][a-zA-Z0-9_]+#", $id)) { throw new Exception("Form::__construct: '{$id}' can not be used as " . "id. Only use numbers and digits."); } C::guardIsFormlet($formlet); C::guardIsString($id); C::guardIsString($action); $attrs = Value::defaultTo($attrs, array()); C::guardEachAndKeys($attrs, "C::guardIsString", "C::guardIsString"); $this->_id = $id; $this->_input = null; $this->_result = null; $attrs["method"] = "post"; $attrs["action"] = $action; $formlet = $formlet->mapHTML(V::fn(function ($dict, $html) use($attrs) { return H::tag("form", $attrs, $html); })); $name_source = NameSource::instantiate($this->_id); $repr = $formlet->instantiate($name_source); $this->_builder = $repr["builder"]; $this->_collector = $repr["collector"]; }
public function catchAndReify($exc_class) { C::guardIsString($exc_class); $re = $this->_reify_exceptions; $re[] = $exc_class; return new FunctionValue($this->_function, $this->_unwrap_args, $this->_args, $this->_arity + count($this->_args), $re, $this->origin()); }
public function __construct($name) { C::guardIsString($name); $this->_name = $name; }
public static function input($type, $attributes = array()) { C::guardIsString($type); $attributes["type"] = $type; return new InputFormlet($attributes); }
public function __construct($content) { C::guardIsString($content); $this->_content = $content; }
public function __construct($text) { C::guardIsString($text); $this->_text = $text; }