/**
  * {@inheritdoc}
  */
 public function getAllTargets()
 {
     $sources = [];
     if ($this->isValid()) {
         $attributeCodes = array_keys($this->webserviceGuesser->getWebservice($this->clientParameters)->getAllAttributes());
         foreach ($attributeCodes as $attributeCode) {
             $sources[] = ['id' => $attributeCode, 'text' => $attributeCode];
         }
     }
     return $sources;
 }
 /**
  * {@inheritdoc}
  */
 public function getAllTargets()
 {
     $targets = [];
     if ($this->isValid()) {
         $storeViews = $this->webserviceGuesser->getWebservice($this->clientParameters)->getStoreViewsList();
         foreach ($storeViews as $storeView) {
             if ($storeView['code'] !== $this->defaultStoreView) {
                 $targets[] = ['id' => $storeView['code'], 'text' => $storeView['code']];
             }
         }
     }
     return $targets;
 }
 /**
  * {@inheritdoc}
  */
 public function getMapping()
 {
     $mapping = new MappingCollection();
     if ($this->isValid()) {
         try {
             $attributes = $this->webserviceGuesser->getWebservice($this->clientParameters)->getAllAttributes();
         } catch (RestCallException $e) {
             return $mapping;
         }
         foreach ($attributes as $attribute) {
             $mapping->add(['source' => $attribute['code'], 'target' => $attribute['attribute_id'], 'deletable' => true]);
         }
     }
     return $mapping;
 }
 /**
  * {@inheritdoc}
  */
 public function getAllTargets()
 {
     $targets = [];
     if ($this->isValid()) {
         try {
             $families = $this->webserviceGuesser->getWebservice($this->clientParameters)->getAttributeSetList();
         } catch (RestCallException $e) {
             return array();
         }
         foreach ($families as $familyId => $family) {
             $targets[] = ['id' => $familyId, 'name' => $family['name']];
         }
     }
     return $targets;
 }
 /**
  * {@inheritdoc}
  */
 public function getAllTargets()
 {
     $targets = [];
     if ($this->isValid()) {
         try {
             $categories = $this->webserviceGuesser->getWebservice($this->clientParameters)->getCategoriesStatus();
         } catch (RestCallException $e) {
             return array();
         }
         foreach ($categories as $categoryId => $category) {
             if ($categoryId != self::ROOT_CATEGORY_ID) {
                 $targets[] = ['id' => $categoryId, 'text' => $category['name']];
             }
         }
     }
     return $targets;
 }
 /**
  * Function called before all item step execution.
  */
 protected function beforeExecute()
 {
     if ($this->beforeExecute) {
         return null;
     }
     $this->beforeExecute = true;
     $this->webservice = $this->webserviceGuesser->getWebservice($this->getClientParameters());
 }
 /**
  * Are the given parameters valid ?
  *
  * @param PrestashopRestClientParameters $clientParameters
  *
  * @return boolean
  */
 public function areValidSoapCredentials(PrestashopRestClientParameters $clientParameters)
 {
     if (null === $clientParameters->isValid()) {
         try {
             $this->urlExplorer->getUrlContent($clientParameters);
             $webservice = $this->webserviceGuesser->getWebservice($clientParameters);
             $webservice->getStoreViewsList();
             $clientParameters->setValidation(true);
         } catch (\Exception $e) {
             $clientParameters->setValidation(false);
         }
     }
     return $clientParameters->isValid();
 }