@param \Magento\Sales\Model\Order $orderData
@param boolean $syncCustomOption

@return null
774750
private function processOrderItems($orderData, $syncCustomOption)
    {
        foreach ($orderData->getAllItems() as $productItem) {
            //product custom options
            $customOptions = [];
            if ($syncCustomOption) {
                $customOptions = $this->_getOrderItemOptions($productItem);
            }

            $productModel = $productItem->getProduct();

            if ($productModel) {
                // category names
                $categoryCollection = $productModel->getCategoryCollection()
                    ->addAttributeToSelect('name');
                $productCat = [];
                foreach ($categoryCollection as $cat) {
                    $categories = [];
                    $categories[] = $cat->getName();
                    $productCat[]['Name'] = $this->limitLength(
                        implode(', ', $categories)
                    );
                }

                $attributes = [];
                //selected attributes from config
                $configAttributes = $this->helper->getWebsiteConfig(
                    \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_PRODUCT_ATTRIBUTES,
                    $orderData->getStore()->getWebsite()
                );

                if ($configAttributes) {
                    $configAttributes = explode(',', $configAttributes);
                    //attributes from attribute set
                    $attributesFromAttributeSet = $this->_getAttributesArray(
                        $productModel->getAttributeSetId()
                    );

                    $attributes = $this->processConfigAttributes(
                        $configAttributes,
                        $attributesFromAttributeSet,
                        $productModel,
                        $attributes
                    );
                }

                $attributeSetName = $this->getAttributeSetName($productModel);

                $productData = [
                    'name' => $productItem->getName(),
                    'sku' => $productItem->getSku(),
                    'qty' => (int)number_format(
                        $productItem->getData('qty_ordered'),
                        2
                    ),
                    'price' => (float)number_format(
                        $productItem->getPrice(),
                        2,
                        '.',
                        ''
                    ),
                    'attribute-set' => $attributeSetName,
                    'categories' => $productCat,
                    'attributes' => $attributes,
                    'custom-options' => $customOptions,
                ];
                if (!$customOptions) {
                    unset($productData['custom-options']);
                }
                $this->products[] = $productData;
            } else {
                // when no product information is available limit to this data
                $productData = [
                    'name' => $productItem->getName(),
                    'sku' => $productItem->getSku(),
                    'qty' => (int)number_format(
                        $productItem->getData('qty_ordered'),
                        2
                    ),
                    'price' => (float)number_format(
                        $productItem->getPrice(),
                        2,
                        '.',
                        ''
                    ),
                    'attribute-set' => '',
                    'categories' => [],
                    'attributes' => [],
                    'custom-options' => $customOptions,
                ];
                if (!$customOptions) {
                    unset($productData['custom-options']);
                }
                $this->products[] = $productData;
            }
        }
    }
762390
public function update($order_id, array $data)
    {
        $result = null;
        $this->hook->attach('order.update.before', $order_id, $data, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        $data['modified'] = GC_TIME;

        $this->prepareComponents($data);

        $result = (bool) $this->db->update('orders', $data, array('order_id' => $order_id));
        $this->hook->attach('order.update.after', $order_id, $data, $result, $this);
        return (bool) $result;
    }
1073625
public function validateAfterSchema($answerData, array $options = [])
    {
        $errors = [];

        /** @var OrderingQuestion $question */
        $question = !empty($options[Validation::QUESTION]) ? $options[Validation::QUESTION] : null;
        if (empty($question)) {
            throw new \LogicException('Answer validation : Cannot perform additional validation without question.');
        }

        $itemIds = array_map(function (OrderingItem $item) {
            return $item->getUuid();
        }, $question->getItems()->toArray());

        foreach ($answerData as $index => $answer) {
            if (!in_array($answer['itemId'], $itemIds)) {
                $errors[] = [
                    'path' => "/[{$index}]",
                    'message' => 'Answer array identifiers must reference question items',
                ];
            }
        }

        return $errors;
    }
101341
private function statusCheckAutomationEnrolment($order, $status, $customerEmail, $websiteId, $storeName)
    {
        $configStatusAutomationMap = $this->serializer->unserialize(
            $this->scopeConfig->getValue(
                \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_AUTOMATION_STUDIO_ORDER_STATUS,
                \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
                $order->getStore()
            )
        );

        if (!empty($configStatusAutomationMap)) {
            foreach ($configStatusAutomationMap as $configMap) {
                if ($configMap['status'] == $status) {
                    //send to automation queue
                    $this->doAutomationEnrolment(
                        [
                            'programId' => $configMap['automation'],
                            'automationType' => 'order_automation_' . $status,
                            'email' => $customerEmail,
                            'order_id' => $order->getIncrementId(),
                            'website_id' => $websiteId,
                            'store_name' => $storeName
                        ]
                    );
                }
            }
        }
    }
861713
public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)
    {
        $captureTransfer = new PayoneCaptureTransfer();

        $paymentTransfer = new PayonePaymentTransfer();
        $paymentTransfer->setFkSalesOrder($orderEntity->getSpyPaymentPayones()->getFirst()->getFkSalesOrder());
        $captureTransfer->setPayment($paymentTransfer);
        $captureTransfer->setAmount($this->getOrderTransfer($orderEntity)->getTotals()->getGrandTotal());
        $captureTransfer->setOrder($this->getOrderTransfer($orderEntity));

        $this->getFacade()->capturePayment($captureTransfer);

        return [];
    }
1300950
public function getPaymentState($orderIndex = 0)
    {
        $paymentAmountInfo = $this->getPaymentAmountInfo($orderIndex);
        return array_key_exists('paymentState', $paymentAmountInfo) ? $paymentAmountInfo['paymentState'] : null;
    }
463322
public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)
    {
        $orderTransfer = $this->getOrderTransfer($orderEntity);
        $this->getFacade()->authorizePayment($orderTransfer);

        return [];
    }
1115612
public function getMediaData($currentId, $dateComparator, $sortOrder, $thumbnail)
    {
        /**
         * @var $current \Drupal\media_entity\Entity\Media
         */
        $current = $this->entityTypeManager
            ->getStorage('media')
            ->load($currentId);

        if(!$current)
        {
            return null;
        }

        $prev_or_next = \Drupal::entityQuery('media')
            ->condition('bundle', $current->bundle())
            ->condition('status', 1)
            ->condition('created', $current->getCreatedTime(), $dateComparator)
            ->sort('created', $sortOrder)
            ->range(0, 1)
            ->execute();

        if(!$prev_or_next)
        {
            return null;
        }

        $gallery = $this->entityTypeManager
            ->getStorage('media')
            ->load(array_values($prev_or_next)[0]);

        $all = $gallery->get('field_media_images');
        if(isset($all[0]))
        {
            $file   = $all[0]->entity->field_image->entity->getFileUri();

            return [
                'id'        => $gallery->id(),
                'title'     => $gallery->label(),
                'path'      => $gallery->toUrl()->toString(),
                'images'    => $all,
                'thumb'     => ImageStyle::load($thumbnail)->buildUrl($file)
            ];
        }


        return null;
    }
626072
private function addPaymentMethods(Order $order, ElementInterface $radioGroup)
    {
        $paymentMethods = $this->getPaymentMethodProvider()->getPaymentMethodsForOrder($order);
        
        $paymentMethods->map(function (PaymentMethod $paymentMethod) use ($radioGroup) {
            $radioGroup->addOptionToSelect($paymentMethod->getId(), $paymentMethod->translate()->getName());
        });
    }
1194396
public function getBindingId($orderIndex = 0)
    {
        $bindingInfo = $this->getBindingInfo($orderIndex);
        return array_key_exists('bindingId', $bindingInfo) ? $bindingInfo['bindingId'] : null;
    }
998615
public function updateOrderPayment($order, $transaction = null, $reference = null, $hookType = null)
    {
        // Fetch transaction info if transaction is not passed as a parameter
        if ($reference && !$transaction) {
            $transaction = $this->fetchTransactionInfo($reference);
        } else {
            $reference = $transaction->reference;
        }

        /** @var OrderPaymentInterface $payment */
        $payment = $order->getPayment();

        $this->checkPaymentMethod($payment);

        // Check for total amount mismatch between magento and bolt order.
        $this->holdOnTotalsMismatch($order, $transaction);

        // Get the last stored transaction parameters
        $prevTransactionState = $payment->getAdditionalInformation('transaction_state');
        $prevTransactionReference = $payment->getAdditionalInformation('transaction_reference');

        // Get the transaction state
        $transactionState = $this->getTransactionState($transaction, $payment, $hookType);

        $newCapture = in_array($transactionState, [self::TS_CAPTURED, self::TS_COMPLETED])
            ? $this->getUnprocessedCapture($payment, $transaction)
            : null;

        // Skip if there is no state change (i.e. fetch transaction call from admin panel / Payment model)
        // Reference check and $newCapture were added to support multiple refunds and captures,
        // valid same state transitions
        if (
            $transactionState == $prevTransactionState &&
            $reference == $prevTransactionReference &&
            !$newCapture
        ) {
            if ($this->isAnAllowedUpdateFromAdminPanel($order, $transactionState)){
                $payment->setIsTransactionApproved(true);
            }
            return;
        }

        if (!$this->validateTransition($prevTransactionState, $transactionState)) {
            throw new LocalizedException(__(
                'Invalid transaction state transition: %1 -> %2',
                $prevTransactionState,
                $transactionState
            ));
        }

        // preset default payment / transaction values
        // before more specific changes below
        if ($newCapture) {
            $amount = $newCapture->amount->amount;
        } else {
            $amount = $transaction->amount->amount;
        }
        $transactionId = $transaction->id;

        $realTransactionId = $parentTransactionId = $payment->getAdditionalInformation('real_transaction_id');
        $realTransactionId = $realTransactionId ?: $transaction->id;
        $paymentAuthorized = (bool)$payment->getAdditionalInformation('authorized');

        $processedCaptures = $this->getProcessedCaptures($payment);
        $processedRefunds = $this->getProcessedRefunds($payment);

        switch ($transactionState) {

            case self::TS_ZERO_AMOUNT:
                $orderState = OrderModel::STATE_PROCESSING;
                $transactionType = Transaction::TYPE_ORDER;
                break;

            case self::TS_PENDING:
                $orderState = OrderModel::STATE_PAYMENT_REVIEW;
                $transactionType = Transaction::TYPE_ORDER;
                break;

            case self::TS_AUTHORIZED:
                $orderState = OrderModel::STATE_PROCESSING;
                $transactionType = Transaction::TYPE_AUTH;
                $transactionId = $transaction->id.'-auth';
                break;

            case self::TS_CAPTURED:
                if (!$newCapture) return;
                $orderState = OrderModel::STATE_PROCESSING;
                $transactionType = Transaction::TYPE_CAPTURE;
                $transactionId = $transaction->id.'-capture-'.$newCapture->id;
                $parentTransactionId = $transaction->id.'-auth';
                break;

            case self::TS_PARTIAL_VOIDED:
                $authorizationTransaction = $payment->getAuthorizationTransaction();
                $authorizationTransaction->closeAuthorization();
                $order->addCommentToStatusHistory($this->getVoidMessage($payment));
                $order->save();
                return;

            case self::TS_COMPLETED:
                if (!$newCapture) return;
                $orderState = OrderModel::STATE_PROCESSING;
                $transactionType = Transaction::TYPE_CAPTURE;
                if ($paymentAuthorized) {
                    $transactionId = $transaction->id.'-capture-'.$newCapture->id;
                    $parentTransactionId = $transaction->id.'-auth';
                } else {
                    $transactionId = $transaction->id.'-payment';
                }
                break;

            case self::TS_CANCELED:
                $orderState = OrderModel::STATE_CANCELED;
                $transactionType = Transaction::TYPE_VOID;
                $transactionId = $transaction->id.'-void';
                $parentTransactionId = $paymentAuthorized ? $transaction->id.'-auth' : $transaction->id;
                break;

            case self::TS_REJECTED_REVERSIBLE:
                $orderState = OrderModel::STATE_HOLDED;
                $transactionType = Transaction::TYPE_ORDER;
                $transactionId = $transaction->id.'-rejected_reversible';
                break;

            case self::TS_REJECTED_IRREVERSIBLE:
                $orderState = OrderModel::STATE_CANCELED;
                $transactionType = Transaction::TYPE_ORDER;
                $transactionId = $transaction->id.'-rejected_irreversible';
                break;

            case self::TS_CREDIT_COMPLETED:
                if (in_array($transaction->id, $processedRefunds)) return;
                $transactionType = Transaction::TYPE_REFUND;
                $transactionId = $transaction->id.'-refund';
                if (Hook::$fromBolt) {
                    // Refunds need to be initiated from the store admin (Invoice -> Credit Memo)
                    // If called from Bolt merchant dashboard there is no enough info to sync the totals
                    $orderState = OrderModel::STATE_HOLDED;
                } else {
                    $orderState = OrderModel::STATE_PROCESSING;
                }
                break;

            default:
                throw new LocalizedException(__(
                    'Unhandled transaction state : %1',
                    $transactionState
                ));
                break;
        }

        // set order state and status
        $this->setOrderState($order, $orderState);

        // format the last transaction data for storing within the order payment record instance

        if ($newCapture) {
            array_push($processedCaptures, $newCapture->id);
        }

        if ($transactionState == self::TS_CREDIT_COMPLETED) {
            array_push($processedRefunds, $transaction->id);
        }

        $paymentData = [
            'real_transaction_id' => $realTransactionId,
            'transaction_reference' => $transaction->reference,
            'transaction_state' => $transactionState,
            'authorized' => $paymentAuthorized || in_array($transactionState, [self::TS_AUTHORIZED, self::TS_CAPTURED]),
            'captures' => implode(',', $processedCaptures),
            'refunds' => implode(',', $processedRefunds)
        ];

        // format the price with currency symbol
        $formattedPrice = $order->getBaseCurrency()->formatTxt($amount / 100);

        $message = __(
            'BOLTPAY INFO :: PAYMENT Status: %1 Amount: %2<br>Bolt transaction: %3',
            $this->getBoltTransactionStatus($transactionState),
            $formattedPrice,
            $this->formatReferenceUrl($transaction->reference)
        );

        $transactionData = $this->formatTransactionData($order, $transaction, $amount);

        // update order payment instance
        $payment->setParentTransactionId($parentTransactionId);
        $payment->setTransactionId($transactionId);
        $payment->setLastTransId($transactionId);
        $payment->setAdditionalInformation($paymentData);
        $payment->setIsTransactionClosed($transactionType != Transaction::TYPE_AUTH);

        // We will create an invoice if we have zero amount or new capture.
        if ($this->isCaptureHookRequest($newCapture) || $this->isZeroAmountHook($transactionState)) {
            $this->validateCaptureAmount($order, $amount / 100);
            $invoice = $this->createOrderInvoice($order, $realTransactionId, $amount / 100);
        }

        if (!$order->getTotalDue()) {
            $payment->setShouldCloseParentTransaction(true);
        }

        if ($newCapture && @$invoice) {
            $this->_eventManager->dispatch(
                'sales_order_payment_capture',
                ['payment' => $payment, 'invoice' => $invoice]
            );
        }

        // build a new transaction record and assign it to the order and payment
        /** @var Transaction $payment_transaction */
        $payment_transaction = $this->transactionBuilder->setPayment($payment)
            ->setOrder($order)
            ->setTransactionId($transactionId)
            ->setAdditionalInformation([
                Transaction::RAW_DETAILS => $transactionData
            ])
            ->setFailSafe(true)
            ->build($transactionType);

        $payment->addTransactionCommentsToOrder(
            $payment_transaction,
            $message
        );

        $payment_transaction->save();

        // save payment and order
        $payment->save();
        $order->save();
    }
818325
public function getFeeValue($cityId, $orderAmount)
	{

		$result = $this->fee($cityId, $orderAmount);
		if (!$result) {
			dd($this->getResultRaw());

			return null;
		}

		return $this->getResultFeeValue();

	}
1205370
function setTimeAttackSynchStartPeriod($synch, $multicall = false)
    {
        if (!is_int($synch)) {
            throw new InvalidArgumentException('synch = ' . print_r($synch, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($synch), $multicall);
    }
857856
private function updateOrder(OrderInterface $order, PaymentEvent $event, $force = false)
    {
        $orderEvent = new OrderEvent($order);
        $orderEvent->setForce($force);

        $this->operator->update($orderEvent);

        if ($orderEvent->hasMessages()) {
            $event->addMessages($orderEvent->getMessages());
        }
    }
67588
public function updateFromApiResponse(array $data): OrderInterface
    {
        $order = $this->orderRepository->findOneByExternalId($data['id']);
        if (!$order) {
            $order = new Order();
        }

        // we start by syncing the currency, since we use the currency to create Money objects
        $currency = $this->currencyRepository->findOneByCode($data['currencyCode']);
        if (!$currency) {
            $currency = $this->currencySynchronizer->syncOne([
                'code' => $data['currencyCode'],
            ]);

            // this means that the currency does not exist anymore
            // @todo create placeholder
            if (!$currency) {
                throw new \RuntimeException('Could not sync currency `'.$data['currencyCode'].'`. Try again');
            }
        }

        $currencyCode = $currency->getIsoCodeAlpha();

        // set shortcuts for embedded objects
        $orderLinesData = $data['orderLines'] ?? [];
        $paymentData = $data['paymentInfo'] ?? [];
        $shippingData = $data['shippingInfo'] ?? [];

        $createdDate = DateTimeImmutable::createFromJson($data['createdDate']);
        $modifiedDate = $data['modifiedDate'] ? DateTimeImmutable::createFromJson($data['modifiedDate']) : null;

        $giftCertificateAmount = DandomainFoundation\createMoneyFromFloat($currencyCode, $data['giftCertificateAmount']);
        $totalPrice = DandomainFoundation\createMoneyFromFloat($currencyCode, $data['totalPrice']);
        $salesDiscount = DandomainFoundation\createMoneyFromFloat($currencyCode, $data['salesDiscount']);
        $paymentMethodFee = DandomainFoundation\createMoneyFromFloat($currencyCode, $paymentData['fee'] ?? 0.0);
        $shippingMethodFee = DandomainFoundation\createMoneyFromFloat($currencyCode, $shippingData['fee'] ?? 0.0);

        $order
            ->setExternalId($data['id'])
            ->setCurrency($currency)
            ->setComment($data['comment'])
            ->setCreatedDate($createdDate)
            ->setCustomerComment($data['customerComment'])
            ->setGiftCertificateAmount($giftCertificateAmount)
            ->setGiftCertificateNumber($data['giftCertificateNumber'])
            ->setIncomplete($data['incomplete'])
            ->setIp($data['ip'])
            ->setModified($data['modified'])
            ->setModifiedDate($modifiedDate)
            ->setReferenceNumber($data['referenceNumber'])
            ->setReferrer($data['referrer'])
            ->setReservedField1($data['reservedField1'])
            ->setReservedField2($data['reservedField2'])
            ->setReservedField3($data['reservedField3'])
            ->setReservedField4($data['reservedField4'])
            ->setReservedField5($data['reservedField5'])
            ->setSalesDiscount($salesDiscount)
            ->setTotalPrice($totalPrice)
            ->setTotalWeight($data['totalWeight'])
            ->setTrackingNumber($data['trackingNumber'])
            ->setTransactionNumber($data['transactionNumber'])
            ->setVatPct((float) $data['vatPct'])
            ->setVatRegNumber($data['vatRegNumber'])
            ->setXmlParams($data['xmlParams'])
            ->setShippingMethodFee($shippingMethodFee)
            ->setPaymentMethodFee($paymentMethodFee)
        ;

        // populate customer info
        $customer = $this->customerUpdater->updateFromEmbeddedApiResponse($data['customerInfo']);
        $order->setCustomer($customer);

        // populate delivery info
        $delivery = $this->deliveryUpdater->updateFromEmbeddedApiResponse($data['deliveryInfo'], $order->getDelivery());
        $order->setDelivery($delivery);

        // populate invoice info
        $invoice = $this->invoiceUpdater->updateFromEmbeddedApiResponse($data['invoiceInfo'], $order->getInvoice());
        $order->setInvoice($invoice);

        // populate payment info
        $paymentMethod = $this->paymentMethodUpdater->updateFromEmbeddedApiResponse($data['paymentInfo'], $currencyCode, $order->getPaymentMethod());
        $order->setPaymentMethod($paymentMethod);

        // populate shipping info
        $shippingMethod = $this->shippingMethodUpdater->updateFromEmbeddedApiResponse($data['shippingInfo'], $currencyCode, $order->getShippingMethod());
        $order->setShippingMethod($shippingMethod);

        // populate site
        $site = $this->siteRepository->findOneByExternalId($data['siteId']);
        if (!$site) {
            $site = $this->siteSynchronizer->syncOne([
                'externalId' => $data['siteId'],
            ]);

            // this means that the site does not exist anymore so we create a placeholder
            if (!$site) {
                $site = new Site();
                $site->setExternalId($data['siteId'])
                    ->setName((string) $data['siteId'])
                    ->setCurrency($currency)
                ;

                // we soft delete the site because it does not exist anymore
                $site->delete();

                $this->siteRepository->save($site);
            }
        }
        $order->setSite($site);

        // populate state
        $state = $this->stateRepository->findOneByExternalId($data['orderState']['id']);
        if(!$state) {
            $state = $this->stateSynchronizer->syncOne([
                'externalId' => $data['orderState']['id']
            ]);

            if(!$state) {
                // @todo create placeholder
                throw new \InvalidArgumentException('The order state `'.$data['orderState']['name'].'` (id: '.$data['orderState']['id'].') does not exist');
            }
        }
        $order->setState($state);

        if (count($orderLinesData)) {
            // first remove order lines that are not present anymore
            $removeOrderLines = [];
            foreach ($order->getOrderLines() as $orderLineEntity) {
                $found = false;
                foreach ($orderLinesData as $orderLineData) {
                    if ($orderLineData['id'] === $orderLineEntity->getExternalId()) {
                        $found = true;
                    }
                }

                if (!$found) {
                    $removeOrderLines[] = $orderLineEntity;
                }
            }

            foreach ($removeOrderLines as $removeOrderLine) {
                $order->removeOrderLine($removeOrderLine);
            }

            // then update the rest of the order lines
            foreach ($orderLinesData as $orderLineData) {
                if (!$orderLineData['id']) {
                    continue;
                }

                $collection = $order
                    ->getOrderLines()
                    ->matching(
                        Criteria::create()->where(Criteria::expr()->eq('externalId', $orderLineData['id']))
                    );

                if ($collection->count()) {
                    $orderLineEntity = $collection->first();
                } else {
                    $orderLineEntity = new OrderLine();
                    $order->addOrderLine($orderLineEntity);
                }

                $orderLineUnitPrice = DandomainFoundation\createMoneyFromFloat($currencyCode, $orderLineData['unitPrice'] ?? 0.0);
                $orderLineTotalPrice = DandomainFoundation\createMoneyFromFloat($currencyCode, $orderLineData['totalPrice'] ?? 0.0);

                $orderLineEntity
                    ->setExternalId((int) $orderLineData['id'])
                    ->setFileUrl($orderLineData['fileUrl'])
                    ->setProductNumber($orderLineData['productId'])
                    ->setProductName($orderLineData['productName'])
                    ->setQuantity((int) $orderLineData['quantity'])
                    ->setTotalPrice($orderLineTotalPrice)
                    ->setUnitPrice($orderLineUnitPrice)
                    ->setVatPct((float) $orderLineData['vatPct'])
                    ->setVariant($orderLineData['variant'])
                    ->setXmlParams($orderLineData['xmlParams'])
                ;

                $product = $this->getProductFromOrderLine($orderLineEntity);
                if ($product) {
                    $orderLineEntity->setProduct($product);
                }
            }
        } else {
            $order->clearOrderLines();
        }

        return $order;
    }
238423
public static function select(Collection $data, $selected = 0, $options = [], $htmlOptions = [])
    {
        if (empty($options['valueColumn']))
            $options['valueColumn'] = Model::PK;
        if (empty($options['titleColumn']))
            $options['titleColumn'] = 'title';
        if (is_array($selected))
            $selected = $selected[$options['valueColumn']];
        if ($selected instanceof Model) {
            $selected = $selected->{$options['valueColumn']};
        }
        if (empty($options['disabled']))
            $options['disabled'] = [];

        if ($options instanceof Std) {
            $options = $options->getData();
        }

        $htmlOptionsText = [];
        foreach ($htmlOptions as $key => $value) {
            if (is_numeric($key)) {
                $htmlOptionsText[] = $value;
            } else {
                $htmlOptionsText[] = $key . '="' . $value . '"';
            }
        }
        $htmlOptionsText = implode(' ', $htmlOptionsText);

        $html = '<select ' . $htmlOptionsText . '>' . "\n";
        if (
            isset($options['null']) && $options['null']
            &&
            $data->first()[$options['valueColumn']] !== 0 && $data->first()[$options['titleColumn']] !== '---'
        ) {
            $data->prepend([$options['valueColumn'] => 0, $options['titleColumn'] => '---']);
        }
        foreach ($data as $item) {
            $html .=
                '<option
                    value="' . $item[$options['valueColumn']] . '"' .
                ($item[$options['valueColumn']] == $selected ? ' selected="selected"' : '') .
                (in_array($item[$options['valueColumn']], $options['disabled']) ? ' disabled="disabled"' : '') .
                '>' .
                (
                    in_array('tree', $options) && isset($options['treeLevelColumn']) && isset($item[$options['treeLevelColumn']])
                        ? str_repeat(self::TREE_LEVEL_SYMBOL, (int)$item[$options['treeLevelColumn']])
                        : ''
                ) . ' ' .
                $item[$options['titleColumn']] .
                '</option>' . "\n";
        }
        $html .= '</select>';
        return $html;
    }
823119
public function getActionCodeDescription($orderIndex = 0)
    {
        $orderStatuses = $this->getOrderStatuses();
        return array_key_exists('actionCodeDescription', $orderStatuses[$orderIndex])
            ? $orderStatuses[$orderIndex]['actionCodeDescription'] : null;
    }