protected function marshallCoords()
    {
        // Retrieve the coordinates array.
        $coords = $this->getToMarshall();
        $array = $coords->getArrayCopy();

        // Retrieve the shape.
        $shape = $coords->getShape();

        // -- Actual marshalling.
        $ctx = $this->getContext();
        $access = $ctx->getStreamAccess();

        // Marshall the $array.
        $args = new PhpArgumentCollection();
        foreach ($array as $a) {
            $args[] = new PhpArgument($a);
        }

        try {
            $arrayVarName = $ctx->generateVariableName($array);
            $access->writeVariable($arrayVarName);
            $access->writeEquals($ctx->mustFormatOutput());
            $access->writeFunctionCall('array', $args);
            $access->writeSemicolon($ctx->mustFormatOutput());

            // Marshall the Coords object.
            $coordsArgs = new PhpArgumentCollection(array(new PhpArgument($coords->getShape()), new PhpArgument(new PhpVariable($arrayVarName))));
            $varName = $ctx->generateVariableName($coords);
            $access->writeVariable($varName);
            $access->writeEquals($ctx->mustFormatOutput());
            $access->writeInstantiation(get_class($coords), $coordsArgs);
            $access->writeSemicolon($ctx->mustFormatOutput());

            $ctx->pushOnVariableStack($varName);
        } catch (StreamAccessException $e) {
            $msg = "An error occured while marshalling a Coords object into the PHP source code stream.";
            throw new PhpMarshallingException($msg, PhpMarshallingException::STREAM, $e);
        }
    }
protected function marshallCoords()
    {
        // Retrieve the coordinates array.
        $coords = $this->getToMarshall();
        $array = $coords->getArrayCopy();

        // Retrieve the shape.
        $shape = $coords->getShape();

        // -- Actual marshalling.
        $ctx = $this->getContext();
        $access = $ctx->getStreamAccess();

        // Marshall the $array.
        $args = new PhpArgumentCollection();
        foreach ($array as $a) {
            $args[] = new PhpArgument($a);
        }

        try {
            $arrayVarName = $ctx->generateVariableName($array);
            $access->writeVariable($arrayVarName);
            $access->writeEquals($ctx->mustFormatOutput());
            $access->writeFunctionCall('array', $args);
            $access->writeSemicolon($ctx->mustFormatOutput());

            // Marshall the Coords object.
            $coordsArgs = new PhpArgumentCollection(array(new PhpArgument($coords->getShape()), new PhpArgument(new PhpVariable($arrayVarName))));
            $varName = $ctx->generateVariableName($coords);
            $access->writeVariable($varName);
            $access->writeEquals($ctx->mustFormatOutput());
            $access->writeInstantiation(get_class($coords), $coordsArgs);
            $access->writeSemicolon($ctx->mustFormatOutput());

            $ctx->pushOnVariableStack($varName);
        } catch (StreamAccessException $e) {
            $msg = "An error occured while marshalling a Coords object into the PHP source code stream.";
            throw new PhpMarshallingException($msg, PhpMarshallingException::STREAM, $e);
        }
    }
protected function marshallCoords ( ) { // Retrieve the coordinates array. $ coords = $ this -> getToMarshall ( ) ; $ array = $ coords -> getArrayCopy ( ) ; // Retrieve the shape. $ shape = $ coords -> getShape ( ) ; // -- Actual marshalling. $ ctx = $ this -> getContext ( ) ; $ access = $ ctx -> getStreamAccess ( ) ; // Marshall the $array. $ args = new PhpArgumentCollection ( ) ; foreach ( $ array as $ a ) { $ args [ ] = new PhpArgument ( $ a ) ; } try { $ arrayVarName = $ ctx -> generateVariableName ( $ array ) ; $ access -> writeVariable ( $ arrayVarName ) ; $ access -> writeEquals ( $ ctx -> mustFormatOutput ( ) ) ; $ access -> writeFunctionCall ( 'array' , $ args ) ; $ access -> writeSemicolon ( $ ctx -> mustFormatOutput ( ) ) ; // Marshall the Coords object. $ coordsArgs = new PhpArgumentCollection ( array ( new PhpArgument ( $ coords -> getShape ( ) ) , new PhpArgument ( new PhpVariable ( $ arrayVarName ) ) ) ) ; $ varName = $ ctx -> generateVariableName ( $ coords ) ; $ access -> writeVariable ( $ varName ) ; $ access -> writeEquals ( $ ctx -> mustFormatOutput ( ) ) ; $ access -> writeInstantiation ( get_class ( $ coords ) , $ coordsArgs ) ; $ access -> writeSemicolon ( $ ctx -> mustFormatOutput ( ) ) ; $ ctx -> pushOnVariableStack ( $ varName ) ; } catch ( StreamAccessException $ e ) { $ msg = "An error occured while marshalling a Coords object into the PHP source code stream." ; throw new PhpMarshallingException ( $ msg , PhpMarshallingException :: STREAM , $ e ) ; } }
Marshall a Coords QTI datatype object.

@throws \qtism\data\storage\php\marshalling\PhpMarshallingException
Marshall a Coords QTI datatype object .