Ejemplo n.º 1
0
 /**
  * Return the Api class instance for the given method.
  *
  * @param string $method
  *
  * @throws \BadMethodCallException
  *
  * @return \Shoperti\PayMe\Contracts\ApiInterface
  */
 protected function getApiInstance($method)
 {
     $gateway = Helper::className($this->getDriver());
     $class = "\\Shoperti\\PayMe\\Gateways\\{$gateway}\\" . Helper::className($method);
     if (!class_exists($class)) {
         throw new BadMethodCallException("Undefined method [{$method}] called.");
     }
     return new $class($this->gateway);
 }