本文整理汇总了PHP中Value类的典型用法代码示例。如果您正苦于以下问题:PHP Value类的具体用法?PHP Value怎么用?PHP Value使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Value类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
*
* @param Context $context
*/
public function handle(Context $context)
{
$string = new StringExpr();
$string->handle($context);
$this->key = $string->getResult();
$nameSeparator = new StructuralChar(array(":"));
$nameSeparator->handle($context);
$value = new Value();
$value->handle($context);
$this->value = $value->getResult();
}
示例2: setContains
/**
* Set Contains comparison.
*
* @param Value $value Value object to compare against
*
* @return boolean
*/
public function setContains(Value $value)
{
if (is_array($value->getValue())) {
foreach ($this->value as $val) {
if ($val instanceof Set && $val == $value->getSet()) {
return true;
}
}
return false;
}
return in_array($value->getValue(), $this->value);
}
示例3: processSquareBracket
private function processSquareBracket($token)
{
$parser = new Value($this->baseData, $this->autoLookup);
if ($this->baseData instanceof \Transphporm\Functionset && $this->baseData->hasFunction($this->last)) {
$this->callTransphpormFunctions($token);
} else {
if ($this->last !== null) {
$this->data->traverse($this->last);
}
$this->last = $parser->parseTokens($token['value'], null)[0];
}
}
示例4: handle
/**
*
* @param Context $context
* @throws DecodeException
*/
public function handle(Context $context)
{
$ws = WS::getInstance();
$ws->handle($context);
$value = new Value();
$value->handle($context);
$ws->handle($context);
if ($context->hasNext()) {
$current = $context->current();
$context->throwException("Unexpected character('{$current}')");
}
$this->result = $value->getResult();
}
示例5: __construct
function __construct($method, $args)
{
$this->method = $method;
$this->args = $args;
$this->xml = '<?xml version="1.0" encoding="utf-8" ?><methodCall><methodName>' . $this->method . '</methodName><params>';
foreach ($this->args as $arg) {
$this->xml .= '<param><value>';
$v = new Value($arg);
$this->xml .= $v->getXml();
$this->xml .= '</value></param>' . LF;
}
$this->xml .= '</params></methodCall>';
}
示例6: parse
function parse($value)
{
if ($value == 'inherit') {
return CSS_PROPERTY_INHERIT;
}
$value = trim(strtolower($value));
switch (strtolower($value)) {
case "xx-small":
return Value::fromData(BASE_FONT_SIZE_PT * 3 / 5, UNIT_PT);
case "x-small":
return Value::fromData(BASE_FONT_SIZE_PT * 3 / 4, UNIT_PT);
case "small":
return Value::fromData(BASE_FONT_SIZE_PT * 8 / 9, UNIT_PT);
case "medium":
return Value::fromData(BASE_FONT_SIZE_PT, UNIT_PT);
case "large":
return Value::fromData(BASE_FONT_SIZE_PT * 6 / 5, UNIT_PT);
case "x-large":
return Value::fromData(BASE_FONT_SIZE_PT * 3 / 2, UNIT_PT);
case "xx-large":
return Value::fromData(BASE_FONT_SIZE_PT * 2 / 1, UNIT_PT);
}
switch (strtolower($value)) {
case "larger":
return Value::fromData(1.2, UNIT_EM);
case "smaller":
return Value::fromData(0.83, UNIT_EM);
// 0.83 = 1/1.2
}
if (preg_match("/(\\d+\\.?\\d*)%/i", $value, $matches)) {
return Value::fromData($matches[1] / 100, UNIT_EM);
}
return Value::fromString($value);
}
示例7: units2pt
function units2pt($value, $font_size = null)
{
$unit = Value::unit_from_string($value);
switch ($unit) {
case UNIT_PT:
return pt2pt((double) $value);
case UNIT_PX:
return px2pt((double) $value);
case UNIT_MM:
return pt2pt(mm2pt((double) $value));
case UNIT_CM:
return pt2pt(mm2pt((double) $value * 10));
case UNIT_EM:
return em2pt((double) $value, $font_size);
case UNIT_EX:
return ex2pt((double) $value, $font_size);
case UNIT_IN:
return pt2pt((double) $value * 72);
// points used by CSS 2.1 are equal to 1/72nd of an inch.
// points used by CSS 2.1 are equal to 1/72nd of an inch.
case UNIT_PC:
return pt2pt((double) $value * 12);
// 1 pica equals to 12 points.
// 1 pica equals to 12 points.
default:
global $g_config;
if ($g_config['mode'] === 'quirks') {
return px2pt((double) $value);
} else {
return 0;
}
}
}
示例8: parse
function parse($value)
{
if ($value == 'inherit') {
return CSS_PROPERTY_INHERIT;
}
return Value::fromString($value);
}
示例9: BoxNoteCall
function BoxNoteCall(&$content, &$pipeline)
{
$this->GenericInlineBox();
$this->_note_content =& $content;
$this->copy_style($content);
$this->put_height_constraint(new HCConstraint(null, null, null));
/**
* Prepare ::note-call box
*/
$this->_note_call_box = InlineBox::create_from_text(CSSListStyleType::format_number(LST_DECIMAL, 99), WHITESPACE_NORMAL, $pipeline);
$this->_note_call_box->copy_style($content);
$this->_note_call_box->content[0]->copy_style($content);
$font = $this->_note_call_box->content[0]->getCSSProperty(CSS_FONT);
$font = $font->copy();
$font->size->scale(0.75);
$this->_note_call_box->content[0]->setCSSProperty(CSS_FONT, $font);
$this->_note_call_box->content[0]->setCSSProperty(CSS_VERTICAL_ALIGN, VA_SUPER);
$this->_note_call_box->content[0]->setCSSProperty(CSS_LINE_HEIGHT, CSS::getDefaultValue(CSS_LINE_HEIGHT));
/**
* Prepare ::marker box
*/
$this->_note_marker_box = InlineBox::create_from_text(CSSListStyleType::format_number(LST_DECIMAL, 99), WHITESPACE_NORMAL, $pipeline);
$this->_note_marker_box->copy_style($content);
$this->_note_marker_box->content[0]->copy_style($content);
$font = $this->_note_marker_box->content[0]->getCSSProperty(CSS_FONT);
$font = $font->copy();
$font->size->scale(0.5);
$this->_note_marker_box->content[0]->setCSSProperty(CSS_FONT, $font);
$margin = $this->_note_marker_box->content[0]->getCSSProperty(CSS_MARGIN);
$margin = $margin->copy();
$margin->right = Value::fromData(FOOTNOTE_MARKER_MARGIN, UNIT_PT);
$this->_note_marker_box->content[0]->setCSSProperty(CSS_MARGIN, $margin);
$this->_note_marker_box->content[0]->setCSSProperty(CSS_VERTICAL_ALIGN, VA_SUPER);
$this->_note_marker_box->content[0]->setCSSProperty(CSS_LINE_HEIGHT, CSS::getDefaultValue(CSS_LINE_HEIGHT));
}
示例10: __construct
/**
* @see DataPermissionInterface::__construct()
* @param string type
* @param integer $id
*/
function __construct($type, $id)
{
if (is_numeric($id) and $type) {
$this->type = $type;
switch ($type) {
case "file":
$this->id = $id;
$this->object = File::get_instance($id);
break;
case "value":
$this->id = $id;
$this->object = Value::get_instance($id);
break;
case "parameter":
$this->id = $id;
$this->object = Parameter::get_instance($id);
break;
case "folder":
$this->id = $id;
$this->object = Folder::get_instance($id);
break;
}
$this->automatic = $this->object->get_automatic();
$this->permission = $this->object->get_permission();
$this->owner_id = $this->object->get_owner_id();
$this->owner_group_id = $this->object->get_owner_group_id();
} else {
$this->id = null;
$this->object = null;
}
}
示例11: equals
/**
* Check for equality of this event against another event.
*
* This overrides the generic equality test because we want to
* include the requestedon timestamp too.
*
* @param Value $other Another value object to compare with this one.
*
* @return boolean
*
* @since __DEPLOY_VERSION__
*/
public function equals(Value $other)
{
// Must have occurred at the same time.
if ($this->requestedon != $other->requestedon) {
return false;
}
return parent::equals($other);
}
示例12: parse
function parse($value)
{
$value = trim($value);
if ($value === 'inherit') {
return CSS_PROPERTY_INHERIT;
}
if ($value === 'normal') {
return $this->_default_value;
}
return Value::fromString($value);
}
示例13: __construct
/**
* A widget containing text (essentially just a div or span with text)
* @param string $text The text to display
* @param boolean $inline Determines if the widget should be span(true) or div(false)
* @param string $id The HTML #id of the element
* @param string $class The HTML .class of element
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($text = EMPTYSTRING, $inline = false, $id = null, $class = null, $args = null)
{
HtmlAttributes::Assure($args);
if (Value::SetAndNotNull($id)) {
$args->Add('id', $id);
}
if (Value::SetAndNotNull($class)) {
$args->Add('class', $class);
}
$tag = $inline ? 'span' : 'div';
parent::__construct($tag, $args, $text);
}
示例14: parse_value
function parse_value($value)
{
switch (strtolower($value)) {
case 'thin':
return Value::fromString('1px');
case 'medium':
return Value::fromString('3px');
case 'thick':
return Value::fromString('5px');
default:
return Value::fromString($value);
}
}
示例15: handle
/**
*
* @param Context $context
*/
public function handle(Context $context)
{
$beginArray = new StructuralChar(array("["));
$beginArray->handle($context);
if ($context->current() === "]") {
$endArray = new StructuralChar(array("]"));
$endArray->handle($context);
$this->result = array();
return;
}
$result = array();
while (true) {
$value = new Value();
$value->handle($context);
$result[] = $value->getResult();
$struct = new StructuralChar(array(",", "]"));
$struct->handle($context);
if ($struct->getResult() === "]") {
$this->result = $result;
break;
}
}
}