public function marshall()
    {
        $ctx = $this->getContext();
        $streamAccess = $ctx->getStreamAccess();

        try {
            $scalar = $this->getToMarshall();
            $varName = $this->getContext()->generateVariableName($scalar);

            $streamAccess->writeVariable($varName);
            $streamAccess->writeEquals($ctx->mustFormatOutput());
            $streamAccess->writeScalar($scalar);
            $streamAccess->writeSemicolon($ctx->mustFormatOutput());

            $ctx->pushOnVariableStack($varName);
        } catch (StreamAccessException $e) {
            $msg = "An error occured while marshalling the scalar value '${scalar}'.";
            throw new PhpMarshallingException($msg, PhpMarshallingException::STREAM, $e);
        }
    }