classes/Builder.php
public static function getTool( $tool, $opts=false, $composerBinary=false )
    {
        // dirty workaround
        if ( $opts == false )
        {
            $opts = self::$options[self::$defaultExt];
        }
        if ( isset( $opts['tools'][$tool] ) && is_string( $opts['tools'][$tool] ) && $opts['tools'][$tool] != '' )
        {
            return escapeshellarg( $opts['tools'][$tool] );
        }
        else if ( isset( $opts['tools'][$tool] ) && is_array( $opts['tools'][$tool] )
            && isset( $opts['tools'][$tool]['binary'] ) && $opts['tools'][$tool]['binary'] != '' )
        {
            return escapeshellarg( $opts['tools'][$tool]['binary'] );
        }
        else
        {
            if ( $composerBinary )
            {
                $vendorDir = self::getVendorDir();
                if ( file_exists( $vendorDir . "/bin/$tool" ) )
                {
                    $file = realpath( $vendorDir . "/bin/$tool" );
                    if ( strtoupper( substr( PHP_OS, 0, 3) ) === 'WIN' )
                    {
                        $file .= '.bat';
                    }
                    return escapeshellarg( $file );
                }
            }
            return escapeshellarg( pake_which( $tool ) );
        }
    }
public static function getTool( $tool, $opts=false, $composerBinary=false )
    {
        // dirty workaround
        if ( $opts == false )
        {
            $opts = self::$options[self::$defaultExt];
        }
        if ( isset( $opts['tools'][$tool] ) && is_string( $opts['tools'][$tool] ) && $opts['tools'][$tool] != '' )
        {
            return escapeshellarg( $opts['tools'][$tool] );
        }
        else if ( isset( $opts['tools'][$tool] ) && is_array( $opts['tools'][$tool] )
            && isset( $opts['tools'][$tool]['binary'] ) && $opts['tools'][$tool]['binary'] != '' )
        {
            return escapeshellarg( $opts['tools'][$tool]['binary'] );
        }
        else
        {
            if ( $composerBinary )
            {
                $vendorDir = self::getVendorDir();
                if ( file_exists( $vendorDir . "/bin/$tool" ) )
                {
                    $file = realpath( $vendorDir . "/bin/$tool" );
                    if ( strtoupper( substr( PHP_OS, 0, 3) ) === 'WIN' )
                    {
                        $file .= '.bat';
                    }
                    return escapeshellarg( $file );
                }
            }
            return escapeshellarg( pake_which( $tool ) );
        }
    }
Find a cli executable, looking first for configured binaries, then in $PATH and/or composer bin dir.
Takes proper care of adding windows suffixes to tool name when needed

@param string $tool e.g. "git"
@param array $opts
@param bool $composerBinary when true, look in vendor/bin before $PATH
@return string