src/Middleware.php
public static function signer(callable $credProvider, callable $signatureFunction)
    {
        return function (callable $handler) use ($signatureFunction, $credProvider) {
            return function (
                CommandInterface $command,
                RequestInterface $request
            ) use ($handler, $signatureFunction, $credProvider) {
                $signer = $signatureFunction($command);
                return $credProvider()->then(
                    function (CredentialsInterface $creds)
                    use ($handler, $command, $signer, $request) {
                        return $handler(
                            $command,
                            $signer->signRequest($request, $creds)
                        );
                    }
                );
            };
        };
    }
public static function signer(callable $credProvider, callable $signatureFunction)
    {
        return function (callable $handler) use ($signatureFunction, $credProvider) {
            return function (
                CommandInterface $command,
                RequestInterface $request
            ) use ($handler, $signatureFunction, $credProvider) {
                $signer = $signatureFunction($command);
                return $credProvider()->then(
                    function (CredentialsInterface $creds)
                    use ($handler, $command, $signer, $request) {
                        return $handler(
                            $command,
                            $signer->signRequest($request, $creds)
                        );
                    }
                );
            };
        };
    }
public static function signer ( callable $ credProvider , callable $ signatureFunction ) { return function ( callable $ handler ) use ( $ signatureFunction , $ credProvider ) { return function ( CommandInterface $ command , RequestInterface $ request ) use ( $ handler , $ signatureFunction , $ credProvider ) { $ signer = $ signatureFunction ( $ command ) ; return $ credProvider ( ) -> then ( function ( CredentialsInterface $ creds ) use ( $ handler , $ command , $ signer , $ request ) { return $ handler ( $ command , $ signer -> signRequest ( $ request , $ creds ) ) ; } ) ; } ; } ; }
Creates a middleware that signs requests for a command.

@param callable $credProvider      Credentials provider function that
returns a promise that is resolved
with a CredentialsInterface object.
@param callable $signatureFunction Function that accepts a Command
object and returns a
SignatureInterface.

@return callable
Creates a middleware that signs requests for a command .