public function open(): Transaction
    {
        $response = ($this->fulfill)(
            new Request(
                Url::fromString('/db/data/transaction'),
                Method::post(),
                new ProtocolVersion(1, 1),
                $this->headers,
                $this->body
            )
        );

        $body = Json::decode((string) $response->body());
        $location = (string) $response
            ->headers()
            ->get('Location')
            ->values()
            ->current();
        $transaction = new Transaction(
            Url::fromString($location),
            $this->clock->at($body['transaction']['expires']),
            Url::fromString($body['commit'])
        );

        $this->transactions = $this->transactions->add($transaction);

        return $transaction;
    }
public function open(): Transaction
    {
        $response = ($this->fulfill)(
            new Request(
                Url::fromString('/db/data/transaction'),
                Method::post(),
                new ProtocolVersion(1, 1),
                $this->headers,
                $this->body
            )
        );

        $body = Json::decode((string) $response->body());
        $location = (string) $response
            ->headers()
            ->get('Location')
            ->values()
            ->current();
        $transaction = new Transaction(
            Url::fromString($location),
            $this->clock->at($body['transaction']['expires']),
            Url::fromString($body['commit'])
        );

        $this->transactions = $this->transactions->add($transaction);

        return $transaction;
    }
public function open ( ) : Transaction { $ response = ( $ this -> fulfill ) ( new Request ( Url :: fromString ( '/db/data/transaction' ) , Method :: post ( ) , new ProtocolVersion ( 1 , 1 ) , $ this -> headers , $ this -> body ) ) ; $ body = Json :: decode ( ( string ) $ response -> body ( ) ) ; $ location = ( string ) $ response -> headers ( ) -> get ( 'Location' ) -> values ( ) -> current ( ) ; $ transaction = new Transaction ( Url :: fromString ( $ location ) , $ this -> clock -> at ( $ body [ 'transaction' ] [ 'expires' ] ) , Url :: fromString ( $ body [ 'commit' ] ) ) ; $ this -> transactions = $ this -> transactions -> add ( $ transaction ) ; return $ transaction ; }
Open a new transaction

@return Transaction
Open a new transaction