@param DateTime $invoiceTime

@return InvoiceInterface
327214
public function setInvoiceTime($invoiceTime)
    {
        if (is_a($invoiceTime, 'DateTime')) {
            $this->invoiceTime = $invoiceTime;
        } else if (is_numeric($invoiceTime)) {
            $invoiceDateTime = new \DateTime('', new \DateTimeZone("UTC"));
            $invoiceDateTime->setTimestamp($invoiceTime);
            $this->invoiceTime = $invoiceDateTime;
        }
        return $this;
    }
910467
public function setInvoice(\Core\Entity\Invoice $invoice = null) {
        $this->invoice = $invoice;

        return $this;
    }
480422
public function getDatetimeObject($datetime = null)
    {
        if ($datetime instanceof DateTimeInterface) {
            return $datetime;
        }

        if (is_integer($datetime)) {
            $datetime = date('Y-m-d H:i:s', $datetime);
        }

        return new DateTime($datetime);
    }
943252
public static function from(\DateTime $dateTime)
    {
        return new self(
            new Hour($dateTime->format('H')),
            new Minute($dateTime->format('i')),
            new Second($dateTime->format('s'))
        );
    }
1222049
public static function formatDate(\DateTimeInterface $dateTime, $format)
    {
        $phpFormats = array(
            self::DATE => "Y-m-d",
            self::DATE_AND_TIME => 'Y-m-d\TH:i:s\Z',
        );
        $phpFormat = $phpFormats[$format];

        return $dateTime->format($phpFormat);
    }
1276142
public function tidyInternal($datetime)
    {
        if (!$datetime) {
            return null;
        }
        // Re-run through formatter to tidy up (e.g. remove time component)
        $formatter = $this->getInternalFormatter();
        $timestamp = $formatter->parse($datetime);
        if ($timestamp === false) {
            // Fallback to strtotime
            $timestamp = strtotime($datetime, DBDatetime::now()->getTimestamp());
            if ($timestamp === false) {
                return null;
            }
        }
        return $formatter->format($timestamp);
    }
424675
public function setDate(DateTimeInterface $dateTime)
    {
        if (!$this->setHeaderFieldModel('Date', $dateTime)) {
            $this->getHeaders()->addDateHeader('Date', $dateTime);
        }

        return $this;
    }
1313308
public static function get_DateTime( &$dateTime )
    {
        if( $dateTime instanceof DateTime ) {
            return $dateTime;
        }
        return !is_null($dateTime)
            ? new DateTime( $dateTime )
            : null
            ;
    }
402253
public function setEmbargoTime(DateTime $time): PageInterface
    {
        $this->addVersion([
            PageVersion::ATTR_PENDING_APPROVAL => false,
            PageVersion::ATTR_EMBARGOED_UNTIL  => $time->getTimestamp(),
        ]);

        return $this;
    }
795553
public function formatInvoice($oInvoice)
    {
        return [
            'id'       => $oInvoice->id,
            'ref'      => $oInvoice->ref,
            'terms'    => $oInvoice->terms,
            'dated'    => $oInvoice->dated->raw,
            'due'      => $oInvoice->due->raw,
            'paid'     => $oInvoice->paid->raw,
            'state'    => $oInvoice->state,
            'currency' => $oInvoice->currency->code,
            'totals'   => $oInvoice->totals,
            'urls'     => $oInvoice->urls,
            'customer' => empty($oInvoice->customer) ? null : [
                'id'    => $oInvoice->customer->id,
                'label' => $oInvoice->customer->label,
            ],
        ];
    }
1324177
public function getInvoicer()
    {
        if (!is_object($this->invoicer)) {
            $this->invoicer = new \FlexiPeeHP\FakturaVydana(null, $this->config);
        }
        return $this->invoicer;
    }
1060515
public function create($data, $invoiceId, $invoiceItemId = null)
    {
        if (isset($invoiceItemId)) {
            return $this->client()->put(
                $data,
                'invoices/{invoiceId}/items/{invoiceItemId}',
                ['invoiceId' => $invoiceId, 'invoiceItemId' => $invoiceItemId]
            );
        }

        return $this->client()->post(
                $data,
                'invoices/{invoiceId}/items',
                ['invoiceId' => $invoiceId]
            );
    }
1332349
protected function getInvoiceDate()
    {
        $date = !empty($this->invoice[Tag::Customer][Tag::Invoice][Tag::IssueDate]) ? $this->invoice[Tag::Customer][Tag::Invoice][Tag::IssueDate] : date(API::DateFormat_Iso);
        return $date;
    }
224313
private function view(InvoiceInterface $invoice)
    {
        $customerAddressLines = $invoice->getCustomer()->getCustomerAddress();

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

        $data = [
            'invoice' => $invoice,
            'customer' => $invoice->getCustomer(),
            'customerAddressLines' => $customerAddressLines,
        ];

        return $this->factory->make('invoices::invoice', $data);
    }
1261961
public function getInvoices(
        DateTime $startDate = null,
        DateTime $endDate = null,
        $max = self::MIRAKL_API_MAX_PAGINATE,
        $offset = self::MIRAKL_API_DEFAULT_OFFSET_PAGINATE,
        $shopId = null,
        $type = 'AUTO_INVOICE',
        $currency = null
    ) {
        $this->restClient->getConfig()->setPath(
            'request.options/headers/Authorization',
            $this->operatorKey
        );
        $command = $this->restClient->getCommand(
            'GetInvoices',
            array(
                'shopId' => $shopId,
                'startDate' => $startDate,
                'endDate' => $endDate,
                'type' => $type,
                'currency' => $currency,
                'max' => $max,
                'offset' => $offset
            )
        );
        $result = $this->restClient->execute($command);

        return $result;
    }
390417
public function addInvoice(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Invoice\Invoice $invoice)
    {
        $this->invoices[] = $invoice;

        return $this;
    }
1125234
public function sendAdvertPurchaseNotification(Invoice $invoice)
    {
        $templateName = 'PaymentBundle:Email:advert.notification.admin.html.twig';

        if($invoice->getTransaction()->getActor() instanceof Actor){
            $email = $invoice->getTransaction()->getActor()->getEmail();
        }elseif($invoice->getTransaction()->getOptic() instanceof Optic){
            $email = $invoice->getTransaction()->getOptic()->getEmail();
        }
        $context = array(
            'order_number'    => $invoice->getTransaction()->getTransactionKey(),
            'invoice_date'      => $invoice->getCreated(),
            'user_email'        => $email,
            'order_details_url' => $this->router->generate('payment_checkout_showinvoice', array('number' => $invoice->getInvoiceNumber()), UrlGeneratorInterface::ABSOLUTE_URL),
        );

        $this->sendMessage($templateName, $context, $this->twigGlobal->getParameter('admin_email'), $this->twigGlobal->getParameter('admin_email'));
    }