Restore stock.

@param int|\WC_Order|null $order Order object.

@return bool
195882
public static function restore_stock( $order ) {
		$order = wc_get_order( $order );
		if (
			! $order
			|| 'yes' !== get_option( 'woocommerce_manage_stock' )
			|| ! apply_filters( 'woocommerce_can_reduce_order_stock', true, $order )
			|| 1 > count( $order->get_items() )
		) {
			// No item to restore.
			return false;
		}
		$restored = false;
		foreach ( $order->get_items( 'line_item' ) as $item ) {
			/* @var \WC_Order_Item_Product $item Order item. */
			$qty = $item->get_quantity();
			$product = $item->get_product();
			if ( ! $qty || ! $product || ! $product->managing_stock() ) {
				continue;
			}
			$name = $product->get_formatted_name();
			$current_stock = $product->get_stock_quantity();
			$new_stock = wc_update_product_stock( $product, $qty, 'increase' );
			if ( ! $new_stock ) {
				// Oops, failed to update stock.
				continue;
			}
			// Add order note.
			// translators: %1$s item name, %2$d current stock quantity, %3$d new stock quantity.
			$order->add_order_note( sprintf( __( '%1$s stock increased from %2$d to %3$d.', 'hametwoo' ), $name, $current_stock, $new_stock ) );
			$restored = true;
		}
		return $restored;
	}
1250855
public function order($order)
    {
        $order = $this->prepareNames(func_get_args(),false);
        $this->order = $order;
        return $this;
    }
1112359
public function releaseAction(Order $order)
    {
        $order->releaseToBuyer();

        $em = $this->getDoctrine()->getEntityManager();
        $em->persist($order);
        $em->flush();

        return $this->redirect($this->generateUrl('Order_show', array(
            'id' => $order->getNumberForPath()
        )));
    }
478780
public function setOrder(\Librinfo\EcommerceBundle\Entity\Order $order = null)
    {
        $this->order = $order;

        return $this;
    }
926970
public function orderBy($columns, $order = 'ASC', $nulls = null)
    {
        return $this->buildSelect()->orderBy($columns, $order, $nulls);
    }
1039401
public function setOrder(int $order) : CNabuDataObject
    {
        if ($order === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$order")
            );
        }
        $this->setValue('nb_site_target_section_order', $order);
        
        return $this;
    }
543538
public function receiveAction(Order $order)
    {
        $order->receiveByHub();

        $em = $this->getDoctrine()->getEntityManager();
        $em->persist($order);
        $em->flush();

        return $this->redirect($this->generateUrl('Order_show', array(
            'id' => $order->getNumberForPath()
        )));
    }
664849
public function isPaymentModuleFor(Order $order)
    {
        $model = $this->getModuleModel();

        return $order->getPaymentModuleId() == $model->getId();
    }
657932
public function createOrder($order = array())
    {
        $myOrder = new Order($order);
        $response = OrderService::createOrder($myOrder);

        if (isset($response["orderCode"])) {
            //success
            return $response;
        } else {
            Error::throwError("apierror");
        }
    }
275071
public function truncateOrderCoupons(OrderInterface $order)
    {
        $orderCoupons = $this
            ->orderCouponRepository
            ->findOrderCouponsByOrder($order);

        if ($orderCoupons instanceof Collection) {
            foreach ($orderCoupons as $orderCoupon) {
                $this
                    ->orderCouponObjectManager
                    ->remove($orderCoupon);
            }

            $this
                ->orderCouponObjectManager
                ->flush($orderCoupons->toArray());
        }

        return $this;
    }
1182713
public function getTotalHubFeeForOrder(\HarvestCloud\CoreBundle\Entity\Order $order)
    {
        return ($order->getLineItemTotal() * $this->getSellerHubRef()->getVariableFee() / 100) + $this->getSellerHubRef()->getFixedFee();
    }
1152716
public function getOrderStatus($orderIndex = 0)
    {
        $orderStatuses = $this->getOrderStatuses();
        return array_key_exists('orderStatus', $orderStatuses[$orderIndex])
            ? $orderStatuses[$orderIndex]['orderStatus'] : null;
    }
1080198
public function getFieldByOrder($order)
    {
        foreach ($this->_fields as $field) {
            if ($field instanceof FieldInterface) {
                if ($field->getOrder() == $order) {
                    return $field;
                }
            }
        }

        return null;
    }
1330792
public function update($order)
    {
        $orderId = "";

        if (is_array($order)) {
            $orderId = $order["id"];
        }
        elseif (is_object($order)) {
            $orderId = $order->id;
        }

        return $this->client->put("/orders/" . rawurlencode($orderId), $order, null);
    }
244977
public function orderBy($order) 
    {
        
        $this->sql .= ' ORDER BY ';
        
        foreach($order as $column) {
            $this->sql .= $this->quoteColumnName($column[0]) .' '. $column[1] . ', ';
        }
        
        $this->sql = trim($this->sql, ', ');
        
        return $this;
    }
433390
public function cancelOrders(RequestOrder $order = null) {
        return $this->delete(['orders'], RawData::class, ($order !== null) ? $order->toArray() : []);
    }
846537
public function destroy(Order $order)
    {
        $this->order->destroy($order);

        return redirect()->route('admin.order.order.index')
            ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('order::orders.title.orders')]));
    }