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);
        }
    }
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);
        }
    }
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 ) ; } }
Marshall the PHP scalar value to be marshalled into PHP source code.

@throws \qtism\data\storage\php\marshalling\PhpMarshallingException If an error occurs while marshalling.
Marshall the PHP scalar value to be marshalled into PHP source code .