/** * Get the Webservice corresponding to the given Magento parameters. * * @param MagentoSoapClientParameters $clientParameters * * @throws NotSupportedVersionException If the magento version is not supported * * @return Webservice */ public function getWebservice(MagentoSoapClientParameters $clientParameters) { if (!$this->webservice) { $client = $this->magentoSoapClientFactory->getMagentoSoapClient($clientParameters); $magentoVersion = $this->getMagentoVersion($client); switch ($magentoVersion) { case AbstractGuesser::MAGENTO_VERSION_1_14: case AbstractGuesser::MAGENTO_VERSION_1_13: case AbstractGuesser::MAGENTO_VERSION_1_12: case AbstractGuesser::MAGENTO_VERSION_1_11: $this->webservice = new WebserviceEE($client); break; case AbstractGuesser::UNKNOWN_VERSION: case AbstractGuesser::MAGENTO_VERSION_1_9: case AbstractGuesser::MAGENTO_VERSION_1_8: case AbstractGuesser::MAGENTO_VERSION_1_7: $this->webservice = new Webservice($client); break; case AbstractGuesser::MAGENTO_VERSION_1_6: $this->webservice = new Webservice16($client); break; default: throw new NotSupportedVersionException(AbstractGuesser::MAGENTO_VERSION_NOT_SUPPORTED_MESSAGE); } } return $this->webservice; }
/** * Get the family normalizer corresponding to the given Magento parameters * @param MagentoSoapClientParameters $clientParameters * * @throws NotSupportedVersionException * @return FamilyNormalizer */ public function getFamilyNormalizer(MagentoSoapClientParameters $clientParameters) { $client = $this->magentoSoapClientFactory->getMagentoSoapClient($clientParameters); $magentoVersion = $this->getMagentoVersion($client); switch ($magentoVersion) { case AbstractGuesser::MAGENTO_VERSION_1_14: case AbstractGuesser::MAGENTO_VERSION_1_13: case AbstractGuesser::MAGENTO_VERSION_1_9: case AbstractGuesser::MAGENTO_VERSION_1_8: case AbstractGuesser::MAGENTO_VERSION_1_7: case AbstractGuesser::MAGENTO_VERSION_1_6: return new FamilyNormalizer(); default: throw new NotSupportedVersionException(AbstractGuesser::MAGENTO_VERSION_NOT_SUPPORTED_MESSAGE); } }