code: 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);
          });
      }
docs: Returns the invoices.
  
  @param bool $filter TRUE for invoices, FALSE for credits, NULL for all
  
  @return \Doctrine\Common\Collections\Collection|InvoiceInterface[]