src/Middleware.php
public static function mapCommand(callable $f)
    {
        return function (callable $handler) use ($f) {
            return function (
                CommandInterface $command,
                RequestInterface $request = null
            ) use ($handler, $f) {
                return $handler($f($command), $request);
            };
        };
    }
public static function mapCommand(callable $f)
    {
        return function (callable $handler) use ($f) {
            return function (
                CommandInterface $command,
                RequestInterface $request = null
            ) use ($handler, $f) {
                return $handler($f($command), $request);
            };
        };
    }
public static function mapCommand ( callable $ f ) { return function ( callable $ handler ) use ( $ f ) { return function ( CommandInterface $ command , RequestInterface $ request = null ) use ( $ handler , $ f ) { return $ handler ( $ f ( $ command ) , $ request ) ; } ; } ; }
Creates a middleware that applies a map function to commands as they
pass through the middleware.

@param callable $f Map function that accepts a command and returns a
command.

@return callable
Creates a middleware that applies a map function to commands as they pass through the middleware .