src/ImboClient/EventSubscriber/PublicKey.php
public function addPublicKey(Event $event) {
        $command = $event['command'];
        $request = $command->getRequest();
        $url = $request->getUrl(true);

        // Don't add public key if query string already contains public key
        if ($url->getQuery()->hasKey('publicKey')) {
            return;
        }

        $client = $request->getClient();
        $publicKey = $client->getPublicKey();
        $user = $client->getUser();

        // No need for the header if the user and public key matches
        if ($user && $user === $publicKey) {
            return;
        }

        $request->setHeader('X-Imbo-PublicKey', $publicKey);
    }
public function addPublicKey(Event $event) {
        $command = $event['command'];
        $request = $command->getRequest();
        $url = $request->getUrl(true);

        // Don't add public key if query string already contains public key
        if ($url->getQuery()->hasKey('publicKey')) {
            return;
        }

        $client = $request->getClient();
        $publicKey = $client->getPublicKey();
        $user = $client->getUser();

        // No need for the header if the user and public key matches
        if ($user && $user === $publicKey) {
            return;
        }

        $request->setHeader('X-Imbo-PublicKey', $publicKey);
    }
public function addPublicKey ( Event $ event ) { $ command = $ event [ 'command' ] ; $ request = $ command -> getRequest ( ) ; $ url = $ request -> getUrl ( true ) ; // Don't add public key if query string already contains public key if ( $ url -> getQuery ( ) -> hasKey ( 'publicKey' ) ) { return ; } $ client = $ request -> getClient ( ) ; $ publicKey = $ client -> getPublicKey ( ) ; $ user = $ client -> getUser ( ) ; // No need for the header if the user and public key matches if ( $ user && $ user === $ publicKey ) { return ; } $ request -> setHeader ( 'X-Imbo-PublicKey' , $ publicKey ) ; }
Add a public key header to the request

@param Event $event The current event
Add a public key header to the request