protected function marshallDuration()
    {
        $duration = $this->getToMarshall();
        $ctx = $this->getContext();
        $access = $ctx->getStreamAccess();

        try {
            $varName = $ctx->generateVariableName($duration);
            $access->writeVariable($varName);
            $access->writeEquals($ctx->mustFormatOutput());
            $args = new PhpArgumentCollection(array(new PhpArgument($duration->__toString())));
            $access->writeInstantiation(get_class($duration), $args);
            $access->writeSemiColon($ctx->mustFormatOutput());

            $ctx->pushOnVariableStack($varName);
        } catch (StreamAccessException $e) {
            $msg = "An error occured while marshalling a Duration object into the PHP source code stream.";
            throw new PhpMarshallingException($msg, PhpMarshallingException::STREAM, $e);
        }
    }