@param OrderLineInterface|int $orderLine Either the OrderLineInterface or the external id

@return bool
435048
public function hasOrderLine($orderLine): bool
    {
        if ($orderLine instanceof OrderLineInterface) {
            $orderLine = $orderLine->getExternalId();
        }

        return $this->orderLines->exists(function ($key, OrderLineInterface $element) use ($orderLine) {
            return $element->getExternalId() === $orderLine;
        });
    }
801149
public function dispatchOrderLineOnCreatedEvent(
        OrderInterface $order,
        CartLineInterface $cartLine,
        OrderLineInterface $orderLine
    ) {
        $orderLineOnCreatedEvent = new OrderLineOnCreatedEvent(
            $order,
            $cartLine,
            $orderLine
        );

        $this->eventDispatcher->dispatch(
            ElcodiCartEvents::ORDERLINE_ONCREATED,
            $orderLineOnCreatedEvent
        );

        return $this;
    }
1140458
public function add($line)
    {
        $host = $this->parse($line);
        if ($host === false ||
            $host !== $line ||
            in_array($host, $this->host)
        ) {
            return false;
        }
        $this->host[] = $line;
        return true;
    }
990987
public function validatePayment($orderId)
    {
        /**
         * Loads order to validate.
         */
        $this
            ->paymentBridge
            ->findOrder($orderId);

        /**
         * Order Not found Exception must be thrown just here.
         */
        if (!$this->paymentBridge->getOrder()) {
            throw new PaymentOrderNotFoundException();
        }

        /**
         * Payment paid successfully.
         *
         * Paid process has ended successfully
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderSuccess(
                $this->paymentBridge,
                $this
                    ->methodFactory
                    ->create()
            );

        return $this;
    }
1050360
public function populateFromOrderLine(OrderLineInterface $orderLine)
    {
        if (!$orderLine->getProduct()) {
            throw new UnsetProductException('No product set on order line with product number: '.$orderLine->getProductNumber());
        }

        $created = new \DateTime($orderLine->getOrder()->getCreatedDate()->format(\DateTime::ATOM));

        $this
            ->setQuantity(-1 * $orderLine->getQuantity()) // we multiply by -1 because we count an order as 'outgoing' from the stock
            ->setPrice($orderLine->getUnitPriceExclVat())
            ->setVatPercentage((string)$orderLine->getVatPct())
            ->setType(static::TYPE_SALE)
            ->setProduct($orderLine->getProduct())
            ->setOrderLine($orderLine)
            ->setReference('Order '.$orderLine->getOrder()->getExternalId())
            ->setCreatedAt($created) // for order lines we specifically override the createdAt and updatedAt dates because the stock movement is actually happening when the order comes in and not when the order is synced
        ;

        $retailPrice = $orderLine->getProduct()->findPriceByCurrency($orderLine->getUnitPrice()->getCurrency());
        if ($retailPrice) {
            $retailPrice = $retailPrice->getUnitPriceExclVat($orderLine->getVatPct());
        } else {
            $retailPrice = $orderLine->getUnitPriceExclVat();
        }

        $this->setRetailPrice($retailPrice);
    }
963
private function isHeaderLine(string $line): bool
    {
        $matches = [];
        if (preg_match('#^diff --git [a|b|c|i|w|o]/(.*) [a|b|c|i|w|o]/(.*)#', $line, $matches)) {
            $this->appendCollectedFileAndChanges();
            $this->currentOperation = File::OP_MODIFIED;
            $this->currentFileName  = $matches[2];
            return true;
        }
        return false;
    }
785702
public function allowDelete($order)
    {
        // TODO: check if order once was confirmed (lookup in activity log)

        // check if order is confirmed
        if ($order->getStatus()->getId() >= OrderStatus::STATUS_CONFIRMED) {
            return false;
        }
        /** @var SalesDependencyClassInterface $dependency */
        foreach ($this->dependencyClasses as $dependency) {
            if (!$dependency->allowDelete($order)) {
                return false;
            }
        }

        return true;
    }
549547
public function deleteOrder(int $orderId) : bool
    {
        Assert::that($orderId)->greaterThan(0, 'The $orderId has to be positive');

        return (bool)$this->master->doRequest('DELETE', sprintf('/admin/WEBAPI/Endpoints/v1_0/OrderService/{KEY}/%d', $orderId));
    }
320226
public function getOrderTotal(OrderInterface $order, $ati = false)
    {
        return $this->calculator->calculateOrderTotal($order, $ati);
    }
442107
public function delete($orderId = null)
    {
        if (empty($orderId)) {
            $orderId = $this->getOrderId();
        }
        
        /** @var QueueHandler $handler */
        $handler = $this->requestHandler();
        return $handler->delete($orderId);
    }
381462
public function pushListLine($line, $flush = false)
    {
        if (trim($line)) {
            $infos = $this->parseListLine($line);

            if ($infos) {
                if ($this->lineInfo) {
                    $this->lineInfo['text'] = $this->createSpan($this->lineInfo['text']);
                    $this->buffer->addLine($this->lineInfo);
                }
                $this->lineInfo = $infos;
            } else {
                if ($this->listFlow || $line[0] == ' ') {
                    $this->lineInfo['text'][] = $line;
                } else {
                    $flush = true;
                }
            }
            $this->listFlow = true;
        } else {
            $this->listFlow = false;
        }

        if ($flush) {
            if ($this->lineInfo) {
                $this->lineInfo['text'] = $this->createSpan($this->lineInfo['text']);
                $this->buffer->addLine($this->lineInfo);
                $this->lineInfo = null;
            }

            return false;
        }

        return true;
    }
662851
public function hasCustomOrdering($orderColumn)
    {
        $methodName = camel_case('laratables_order_'.$orderColumn);

        if (method_exists($this->class, $methodName)) {
            return $methodName;
        }

        return false;
    }
1111659
public function hasOrder($orderId)
    {
        $orderIdList = $this->session->get(self::SESSIONNAME, array());

        return true === in_array($orderId, $orderIdList);
    }
361697
public function closeOrder($orderId)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_ORDER_CLOSE_PREFIX, [
            'order_id' => $orderId,
        ], [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'success';
    }
174655
public function setOrderPCode($orderPCode)
    {
        if (!is_array($orderPCode)) {
            $this->orderPCode = null;

            return false;
        }
        $isValid = true;
        $index = 0;
        while ($isValid && $index < count($orderPCode)) {
            if (strlen($orderPCode[$index]) > 20) {
                $isValid = false;
            } else {
                $isValid = true;
            }
            $index++;
        }
        if (!$isValid) {
            $this->orderPCode = null;

            return false;
        }
        $this->orderPCode = $orderPCode;

        return true;
    }
683151
public static function cancel($orderId)
    {
        $url = static::classUrl();
        $url = $url . '/' . $orderId . '/cancel';
        list($ret, $code) = parent::staticRequest('post', $url, []);

        return (object)[
            'code' => $code,
            'status' => $code === 200? 'success' : 'failed'
        ];
    }
1051210
public function isAutoInline($autoInline = null)
    {
        if ($autoInline !== null) {
            $this->autoInline = (bool) $autoInline;
        }

        return $this->autoInline;
    }