public static function build($name)
    {
        $class = '\\Ebanx\\Command\\';

        $className = str_replace('do', '', $name);

        if ($className == $name)
        {
            $className = str_replace('get', '', $name);
        }

        $class .= $className;

        // Request command is different depending on the checkout method (Ebanx or direct)
        if ($className == 'Request')
        {
            // Use EBANX direct
            if (\Ebanx\Config::getDirectMode() == true)
            {
                $class .= '\\Direct';
            }
            // Use EBANX checkout
            else
            {
                $class .= '\\Checkout';
            }
        }

        if (class_exists($class))
        {
            return new $class();
        }
        else
        {
            throw new \RuntimeException("Command '$className' doesn't exist.");
        }
    }
public static function build($name)
    {
        $class = '\\Ebanx\\Command\\';

        $className = str_replace('do', '', $name);

        if ($className == $name)
        {
            $className = str_replace('get', '', $name);
        }

        $class .= $className;

        // Request command is different depending on the checkout method (Ebanx or direct)
        if ($className == 'Request')
        {
            // Use EBANX direct
            if (\Ebanx\Config::getDirectMode() == true)
            {
                $class .= '\\Direct';
            }
            // Use EBANX checkout
            else
            {
                $class .= '\\Checkout';
            }
        }

        if (class_exists($class))
        {
            return new $class();
        }
        else
        {
            throw new \RuntimeException("Command '$className' doesn't exist.");
        }
    }
public static function build ( $ name ) { $ class = '\\Ebanx\\Command\\' ; $ className = str_replace ( 'do' , '' , $ name ) ; if ( $ className == $ name ) { $ className = str_replace ( 'get' , '' , $ name ) ; } $ class .= $ className ; // Request command is different depending on the checkout method (Ebanx or direct) if ( $ className == 'Request' ) { // Use EBANX direct if ( \ Ebanx \ Config :: getDirectMode ( ) == true ) { $ class .= '\\Direct' ; } // Use EBANX checkout else { $ class .= '\\Checkout' ; } } if ( class_exists ( $ class ) ) { return new $ class ( ) ; } else { throw new \ RuntimeException ( "Command '$className' doesn't exist." ) ; } }
Returns an instance of the command class
@param  string $name The command name in the form 'doCommand'
@return \Ebanx\Command\AbstractCommand
@throws RuntimeException
Returns an instance of the command class