public function configure($subject)
    {
        if ($subject instanceof InvoiceInterface) {
            $this->date = $subject->getCreatedAt()->format('Y-m-d');
        } elseif ($subject instanceof PaymentInterface) {
            $this->date = $subject->getCompletedAt()->format('Y-m-d');
        } else {
            throw new InvalidArgumentException(
                "Expected instance of " . InvoiceInterface::class . " or " . PaymentInterface::class
            );
        }

        $this->number = $subject->getNumber();

        $sale = $subject->getSale();

        if ($customer = $sale->getCustomer()) {
            $this->identity = $customer->getFirstName() . ' ' . $customer->getLastName();
        } else {
            $this->identity = $sale->getFirstName() . ' ' . $sale->getLastName();
        }
    }
public function configure($subject)
    {
        if ($subject instanceof InvoiceInterface) {
            $this->date = $subject->getCreatedAt()->format('Y-m-d');
        } elseif ($subject instanceof PaymentInterface) {
            $this->date = $subject->getCompletedAt()->format('Y-m-d');
        } else {
            throw new InvalidArgumentException(
                "Expected instance of " . InvoiceInterface::class . " or " . PaymentInterface::class
            );
        }

        $this->number = $subject->getNumber();

        $sale = $subject->getSale();

        if ($customer = $sale->getCustomer()) {
            $this->identity = $customer->getFirstName() . ' ' . $customer->getLastName();
        } else {
            $this->identity = $sale->getFirstName() . ' ' . $sale->getLastName();
        }
    }
public function configure ( $ subject ) { if ( $ subject instanceof InvoiceInterface ) { $ this -> date = $ subject -> getCreatedAt ( ) -> format ( 'Y-m-d' ) ; } elseif ( $ subject instanceof PaymentInterface ) { $ this -> date = $ subject -> getCompletedAt ( ) -> format ( 'Y-m-d' ) ; } else { throw new InvalidArgumentException ( "Expected instance of " . InvoiceInterface :: class . " or " . PaymentInterface :: class ) ; } $ this -> number = $ subject -> getNumber ( ) ; $ sale = $ subject -> getSale ( ) ; if ( $ customer = $ sale -> getCustomer ( ) ) { $ this -> identity = $ customer -> getFirstName ( ) . ' ' . $ customer -> getLastName ( ) ; } else { $ this -> identity = $ sale -> getFirstName ( ) . ' ' . $ sale -> getLastName ( ) ; } }
Configures the writer for the given subject.

@param InvoiceInterface|PaymentInterface $subject
Configures the writer for the given subject .