/**
  * validate the transferfile
  *
  * @throws \Digitick\Sepa\Exception\InvalidTransferTypeException
  */
 public function validate()
 {
     parent::validate();
     /** @var $payment PaymentInformation */
     foreach ($this->paymentInformations as $payment) {
         if (count($payment->getTransfers()) === 0) {
             throw new InvalidTransferFileConfiguration('PaymentInformation must at least contain one payment');
         }
         foreach ($payment->getTransfers() as $transfer) {
             if (!$transfer instanceof CustomerCreditTransferInformation) {
                 throw new InvalidTransferTypeException('Transfers must be of type CustomerCreditTransferInformation instead of: ' . get_class($transfer));
             }
         }
     }
 }
 /**
  * validate the transferfile
  *
  * @throws \Digitick\Sepa\Exception\InvalidTransferTypeException
  */
 public function validate()
 {
     parent::validate();
     /** @var $payment PaymentInformation */
     foreach ($this->paymentInformations as $payment) {
         if ((string) $payment->getSequenceType() === '') {
             throw new InvalidTransferFileConfiguration('Payment must contain a SequenceType');
         }
         if ((string) $payment->getCreditorId() === '') {
             throw new InvalidTransferFileConfiguration('Payment must contain a CreditorSchemeId');
         }
         foreach ($payment->getTransfers() as $transfer) {
             if (!$transfer instanceof CustomerDirectDebitTransferInformation) {
                 throw new InvalidTransferTypeException('Transfers must be of type \\Digitick\\Sepa\\TransferInformation\\CustomerDirectDebitTransferInformation instead of: ' . get_class($transfer));
             }
         }
     }
 }