eZ\Publish\Core\REST\Common\Output\Generator\Json::startValueElement PHP Method

startValueElement() public method

Start value element.
public startValueElement ( string $name, string $value, array $attributes = [] )
$name string
$value string
$attributes array
    public function startValueElement($name, $value, $attributes = array())
    {
        $this->checkStartValueElement($name);
        $jsonValue = null;
        if (empty($attributes)) {
            $jsonValue = $value;
        } else {
            $jsonValue = new Json\Object($this->json);
            foreach ($attributes as $attributeName => $attributeValue) {
                $jsonValue->{'_' . $attributeName} = $attributeValue;
            }
            $jsonValue->{'#text'} = $value;
        }
        if ($this->json instanceof Json\ArrayObject) {
            $this->json[] = $jsonValue;
        } else {
            $this->json->{$name} = $jsonValue;
        }
    }