/** * Get the Webservice corresponding to the given Prestashop parameters. * * @param PrestashopRestClientParameters $clientParameters * * @throws NotSupportedVersionException If the prestashop version is not supported * * @return Webservice */ public function getWebservice(PrestashopRestClientParameters $clientParameters) { if (!$this->webservice) { $client = $this->prestashopSoapClientFactory->getPrestashopSoapClient($clientParameters); $prestashopVersion = $this->getPrestashopVersion($client); switch ($prestashopVersion) { case AbstractGuesser::UNKNOWN_VERSION: case AbstractGuesser::PRESTASHOP_VERSION_1_14: case AbstractGuesser::PRESTASHOP_VERSION_1_13: case AbstractGuesser::PRESTASHOP_VERSION_1_12: case AbstractGuesser::PRESTASHOP_VERSION_1_11: $this->webservice = new PrestashopWebservice($client); break; default: throw new NotSupportedVersionException(AbstractGuesser::PRESTASHOP_VERSION_NOT_SUPPORTED_MESSAGE); } } return $this->webservice; }
/** * Get the family normalizer corresponding to the given Prestashop parameters. * * @param PrestashopRestClientParameters $clientParameters * * @throws NotSupportedVersionException * * @return FamilyNormalizer */ public function getFamilyNormalizer(PrestashopRestClientParameters $clientParameters) { $client = $this->prestashopSoapClientFactory->getPrestashopSoapClient($clientParameters); $prestashopVersion = $this->getPrestashopVersion($client); switch ($prestashopVersion) { case AbstractGuesser::PRESTASHOP_VERSION_1_14: case AbstractGuesser::PRESTASHOP_VERSION_1_13: case AbstractGuesser::PRESTASHOP_VERSION_1_12: case AbstractGuesser::PRESTASHOP_VERSION_1_11: case AbstractGuesser::PRESTASHOP_VERSION_1_9: case AbstractGuesser::PRESTASHOP_VERSION_1_8: case AbstractGuesser::PRESTASHOP_VERSION_1_7: case AbstractGuesser::PRESTASHOP_VERSION_1_6: return $this->familyNormalizer; default: throw new NotSupportedVersionException(AbstractGuesser::PRESTASHOP_VERSION_NOT_SUPPORTED_MESSAGE); } }