public function addCredit(Credit $credit)
    {
        if ($credit->getPaymentInstruction() !== $this) {
            throw new \InvalidArgumentException('This credit container belongs to another instruction.');
        }

        $this->credits->add($credit);
    }
public function addCredit(Credit $credit)
    {
        if ($credit->getPaymentInstruction() !== $this) {
            throw new \InvalidArgumentException('This credit container belongs to another instruction.');
        }

        $this->credits->add($credit);
    }
public function addCredit ( Credit $ credit ) { if ( $ credit -> getPaymentInstruction ( ) !== $ this ) { throw new \ InvalidArgumentException ( 'This credit container belongs to another instruction.' ) ; } $ this -> credits -> add ( $ credit ) ; }
This method adds a Credit container to this PaymentInstruction.

This method is called automatically from Credit::__construct().

@param Credit $credit
This method adds a Credit container to this PaymentInstruction .