本文整理汇总了PHP中Parameter::fromJson方法的典型用法代码示例。如果您正苦于以下问题:PHP Parameter::fromJson方法的具体用法?PHP Parameter::fromJson怎么用?PHP Parameter::fromJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parameter
的用法示例。
在下文中一共展示了Parameter::fromJson方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _build
private function _build()
{
$deploy = $this->_get_deploy();
// get domains
$domains = array();
foreach ($deploy->{'domains'} as $d) {
$domain = Domain::fromJson($d);
$domains[$domain->getId()] = $domain;
Logger::debug("load domain %s", $domain->toString());
}
// get layers
foreach ($deploy->{'layers'} as $l) {
$domain = $domains[$l->{'domain_id'}];
$layer = new Layer($l->{'id'}, $domain);
$this->_layers[$l->{'id'}] = $layer;
Logger::debug("load layer %s", $layer->toString());
}
// assign experiments
foreach ($deploy->{'experiments'} as $e) {
$exp = Experiment::fromJson($e);
$this->_exps[$exp->getId()] = $exp;
$layer = $this->_layers[$exp->getLayerId()];
$layer->assign($exp);
Logger::debug("load exp %s", $exp->toString());
}
foreach ($deploy->{'parameters'} as $p) {
$param = Parameter::fromJson($p);
$this->_baseParams[$param->getName()] = $param->getValue();
Logger::debug("load param %s => %s", $param->getName(), $param->getValue());
}
}
示例2: fromJson
public static function fromJson($json)
{
$parameters = array();
foreach ($json->{'parameters'} as $p) {
$param = Parameter::fromJson($p);
$parameters[$param->getName()] = $param->getValue();
}
$conditions = array();
foreach ($json->{'conditions'} as $c) {
$cond = Condition::fromJson($c);
$conditions[$cond->getName()] = $cond->getArgs();
}
// TODO ranges seems useless
$ranges = array();
foreach ($json->{'ranges'} as $range) {
$ranges[] = BucketRange::fromJson($range);
}
return new self($json->{'id'}, $json->{'layer_id'}, $json->{'start_time'}, $json->{'end_time'}, $json->{'diversion'}, $parameters, $conditions, $ranges);
}