public function getInvoices($filter = null)
    {
        if (null === $filter) {
            return $this->invoices;
        }

        return $this->invoices->filter(function(InvoiceInterface $invoice) use ($filter) {
            return $filter xor InvoiceTypes::isCredit($invoice);
        });
    }
public function getInvoices($filter = null)
    {
        if (null === $filter) {
            return $this->invoices;
        }

        return $this->invoices->filter(function(InvoiceInterface $invoice) use ($filter) {
            return $filter xor InvoiceTypes::isCredit($invoice);
        });
    }
Returns the invoices.

@param bool $filter TRUE for invoices, FALSE for credits, NULL for all

@return \Doctrine\Common\Collections\Collection|InvoiceInterface[]