objectManager = $objectManager; } /** * Creates new instances of API models * * @param string $className * @return \Klarna\Ordermanagement\Api\ApiInterface * @throws \Magento\Framework\Exception\LocalizedException */ public function create($className) { $method = $this->objectManager->create($className); if (!$method instanceof \Klarna\Ordermanagement\Api\ApiInterface) { throw new \Magento\Framework\Exception\LocalizedException( __('%1 class doesn\'t implement \Klarna\Ordermanagement\Api\ApiInterface', $className) ); } return $method; } }