src/ServiceRuntime/Internal/XmlCurrentStateSerializer.php
public function serialize(CurrentState $state, $outputStream)
    {
        $statusLeaseInfo = [
            'StatusLease' => [
                '@attributes' => [
                    'ClientId' => $state->getClientId(),
                ],
            ],
        ];

        if ($state instanceof AcquireCurrentState) {
            $statusLeaseInfo['StatusLease']['Acquire'] = [
                'Incarnation' => $state->getIncarnation(),
                'Status' => $state->getStatus(),
                'Expiration' => Utilities::isoDate(
                    date_timestamp_get($state->getExpiration())
                ),
            ];
        } elseif ($state instanceof ReleaseCurrentState) {
            $statusLeaseInfo['StatusLease']['Release'] = [];
        }

        $currentState = Utilities::serialize($statusLeaseInfo, 'CurrentState');
        fwrite($outputStream, $currentState);
    }
public function serialize(CurrentState $state, $outputStream)
    {
        $statusLeaseInfo = [
            'StatusLease' => [
                '@attributes' => [
                    'ClientId' => $state->getClientId(),
                ],
            ],
        ];

        if ($state instanceof AcquireCurrentState) {
            $statusLeaseInfo['StatusLease']['Acquire'] = [
                'Incarnation' => $state->getIncarnation(),
                'Status' => $state->getStatus(),
                'Expiration' => Utilities::isoDate(
                    date_timestamp_get($state->getExpiration())
                ),
            ];
        } elseif ($state instanceof ReleaseCurrentState) {
            $statusLeaseInfo['StatusLease']['Release'] = [];
        }

        $currentState = Utilities::serialize($statusLeaseInfo, 'CurrentState');
        fwrite($outputStream, $currentState);
    }
public function serialize ( CurrentState $ state , $ outputStream ) { $ statusLeaseInfo = [ 'StatusLease' => [ '@attributes' => [ 'ClientId' => $ state -> getClientId ( ) , ] , ] , ] ; if ( $ state instanceof AcquireCurrentState ) { $ statusLeaseInfo [ 'StatusLease' ] [ 'Acquire' ] = [ 'Incarnation' => $ state -> getIncarnation ( ) , 'Status' => $ state -> getStatus ( ) , 'Expiration' => Utilities :: isoDate ( date_timestamp_get ( $ state -> getExpiration ( ) ) ) , ] ; } elseif ( $ state instanceof ReleaseCurrentState ) { $ statusLeaseInfo [ 'StatusLease' ] [ 'Release' ] = [ ] ; } $ currentState = Utilities :: serialize ( $ statusLeaseInfo , 'CurrentState' ) ; fwrite ( $ outputStream , $ currentState ) ; }
Serializes the current state.

@param CurrentState $state        The current state
@param resource     $outputStream The output stream
Serializes the current state .