@param string              $ean
@param ProductDataTransfer $data

@return string
@throws \Hitmeister\Component\Api\Exceptions\ServerException
341115
public function upsert($ean, ProductDataTransfer $data)
	{
		$endpoint = new Upsert($this->getTransport());
		$endpoint->setId($ean);
		$endpoint->setTransfer($data);

		$resultRequest = $endpoint->performRequest();

		return $resultRequest['status'] == 201;
	}
111805
public function handleAction(GridField $gridField, $actionName, $arguments, $data)
    {
        if ($actionName === 'archiverecord') {
            /** @var DataObject|Versioned $item */
            $item = $gridField->getList()->byID($arguments['RecordID']);
            if (!$item) {
                return;
            }

            if (!$item->canArchive()) {
                throw new ValidationException(
                    _t(__CLASS__ . '.ArchivePermissionsFailure', "No archive permissions")
                );
            }

            $item->doArchive();
        }
    }
457077
function process(advertiserData) {
  var altBeacon = {};
  var data = advertiserData.manufacturerSpecificData.data;

  altBeacon.id = data.substr(4,40);
  altBeacon.refRSSI = pdu.convertTxPower(data.substr(44,2));
  altBeacon.mfgReserved = data.substr(46,2);

  advertiserData.manufacturerSpecificData.altBeacon = altBeacon;
}
851758
public function reverseTransform($data)
    {
        if (is_null($data) || empty($data)) {
            return '';
        }

        $formatter = $this->getFormatter();

        $value = $formatter->parse($data);

        if (intl_is_failure($formatter->getErrorCode())) {
            throw new DataTransformerException($formatter->getErrorMessage());
        }

        return $value;
    }
65085
protected function setItemByProductData($productData, ApiItemInterface $item, $locale)
    {
        $productId = $this->getProductId($productData, 'product.id');

        /** @var Product $product */
        $product = $this->productRepository->find($productId);
        if (!$product) {
            throw new ProductNotFoundException(self::$productEntityName, $productId);
        }
        $item->setProduct($product);
        $translation = $product->getTranslation($locale);

        // When the product is not available in the current language choose the first translation you find.
        if (is_null($translation)) {
            if (count($product->getTranslations()) > 0) {
                $translation = $product->getTranslations()[0];
            } else {
                throw new ProductException('Product ' . $product->getId() . ' has no translations!');
            }
        }

        $this->setItemSupplier($item, $product);

        $item->setName($translation->getName());
        $item->setDescription($translation->getLongDescription());
        $item->setNumber($product->getNumber());

        // set order unit
        if ($product->getOrderUnit()) {
            $item->setQuantityUnit($product->getOrderUnit()->getTranslation($locale)->getName());
        } else if ($product->getParent() && $product->getParent()->getOrderUnit()) {
            $item->setQuantityUnit($product->getParent()->getOrderUnit()->getTranslation($locale)->getName());
        }

        $item->setIsRecurringPrice($product->isRecurringPrice());

        $taxClass = $product->getTaxClass();

        /*
         * If the product doesn't have a taxClass but has a parent, we try to get the taxClass from the parent.
         * This is used for product variants, which get the taxClass from the original product.
         */
        if (!$taxClass && $product->getParent()) {
            $taxClass = $product->getParent()->getTaxClass();
        }

        if ($taxClass) {
            $tax = $this->retrieveTaxForClass($taxClass);
            $item->setTax($tax);
        } else {
            $item->setTax(0);
        }

        return $product;
    }
171076
private function getDataExtension(string $extractName): DataExtensionInterface
    {
        return $this->dataExtensions->has($extractName) ? $this->dataExtensions->get($extractName) : $this->dataExtension;
    }
1363809
public function generateFilename(DNDataTransfer $dataTransfer) {
		$generator = new RandomGenerator();
		$filter = FileNameFilter::create();

		return sprintf(
			'%s-%s-%s-%s-%s',
			$filter->filter(strtolower($this->OriginalEnvironment()->Project()->Name)),
			$filter->filter(strtolower($this->OriginalEnvironment()->Name)),
			$dataTransfer->Mode,
			date('Ymd'),
			sha1($generator->generateEntropy())
		);
	}
1347873
public static function selectOne($sqlstatement, array $data = [])
    {
        static::verifyConnection();

        if (!preg_match("/^select\s.+?\sfrom\s.+;?$/i", $sqlstatement)) {
            throw new DatabaseException(
                'Syntax Error on the Request',
                E_USER_ERROR
            );
        }

        // Prepare query
        $pdostatement = static::$adapter
            ->getConnection()
            ->prepare($sqlstatement);

        // Bind data
        static::$adapter->bind($pdostatement, $data);

        // Execute query
        $pdostatement->execute();

        return Sanitize::make($pdostatement->fetch());
    }
532347
protected function processUpdateAction(
        array $data,
        ProductSaleElements $pse,
        Product $product
    ) {
        list($price, $salePrice) = $this->extractPrices($data);

        $event = new ProductSaleElementUpdateEvent($product, $pse->getId());

        $event
            ->setWeight($data["weight"])
            ->setTaxRuleId($data["tax_rule_id"])
            ->setEanCode($data["ean_code"])
            ->setOnsale($data["onsale"])
            ->setReference($data["reference"])
            ->setIsdefault($data["isdefault"])
            ->setIsnew($data["isnew"])
            ->setCurrencyId($data["currency_id"])
            ->setPrice($price)
            ->setSalePrice($salePrice)
            ->setQuantity($data["quantity"])
            ->setFromDefaultCurrency($data["use_exchange_rate"])
        ;

        $this->dispatch(TheliaEvents::PRODUCT_UPDATE_PRODUCT_SALE_ELEMENT, $event);
    }
340479
public function importProductPackagingUnits(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createProductPackagingUnitDataImport()->import($dataImporterConfigurationTransfer);
    }
686857
public function importProductMeasurementSalesUnit(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()
            ->getProductMeasurementSalesUnitDataImporter()
            ->import($dataImporterConfigurationTransfer);
    }
283009
private function sendDeleteRequest($data) {
		switch($this->getMayor()) {
			case 1:
				return $this->getSoapClient()->DeleteShipmentDD($data);
			case 2:
			default:
				return $this->getSoapClient()->deleteShipmentOrder($data);
		}
	}
1312350
protected function buildProductSpecifications(array &$productData, array $specifications)
    {
        /** @var array $specification */
        foreach ($specifications as $specification) {
            $key   = $this->arrayExtract($specification, 'key', '');
            $value = $this->arrayExtract($specification, 'value', '');

            if (is_array($key) || is_array($value)) {
                continue;
            }

            $productData['specifications'][] = [
                'key'   => (string) $key,
                'value' => (string) $value,
            ];
        }

        return $productData;
    }
853185
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()
            ->createPriceProductDataImport()
            ->import($dataImporterConfigurationTransfer);
    }
630377
public function getDataTableOptions($field, $data)
    {
        $methodName = 'get'.studly_case($this->fieldName).'DataTableOptions';

        if (!$this->model->methodExists($methodName) && !$this->model->methodExists('getDataTableOptions')) {
            throw new ApplicationException(Lang::get('backend::lang.model.missing_method', ['class' => get_class($this->model), 'method' => 'getDataTableOptions']));
        }

        if ($this->model->methodExists($methodName)) {
            $result = $this->model->$methodName($field, $data);
        }
        else {
            $result = $this->model->getDataTableOptions($this->fieldName, $field, $data);
        }

        if (!is_array($result)) {
            $result = [];
        }

        return $result;
    }
927969
public function dataToEntity(array $data)
    {
        $cartItem = new \ShopgateExternalCoupon();
        foreach ($data as $key => $value) {
            $method = 'set' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($key);
            if (method_exists($cartItem, $method)) {
                $cartItem->{$method}($value);
            }
        }

        return $cartItem;
    }
307328
public static function createFromData(array $data)
    {
        if (!isset($data['method'])) {
            throw new DomainException(self::MSG_REQUIRED_METHOD);
        }

        switch ($data['method']) {
            case PaymentMethod::METHOD_ACH:
                $paymentInstrument = new AchInstrument($data);

                break;
            case PaymentMethod::METHOD_CASH:
                $paymentInstrument = new CashInstrument($data);

                break;
            case PaymentMethod::METHOD_PAYMENT_CARD:
                $paymentInstrument = new PaymentCardInstrument($data);

                break;
            case PaymentMethod::METHOD_PAYPAL:
                $paymentInstrument = new PayPalInstrument($data);

                break;
            default:
                throw new DomainException(
                    sprintf(self::MSG_UNSUPPORTED_METHOD, implode(',', self::$supportMethods))
                );
        }

        return $paymentInstrument;
    }