/** * * @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(); }
/** * * @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(); }
/** * * @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; } } }