public function build(array $data)
    {
        $this->validateArrayKeys(
            array('payment_method'),
            $data
        );

        if ( ! in_array($data['payment_method'], array('credit_card', 'paypal'))) {

            throw new BuilderException('Parameter payment_method not valid. Allowed values: "credit_card" and "paypal"');
        }

        $fundingInstruments = array();
        if (isset($data['funding_instruments'])) {
            $fundingInstruments = $data['funding_instruments'];
        }

        $info = array();
        if (isset($data['payer_info'])) {
            $info = $data['payer_info'];
        }

        return new Payer($data['payment_method'], $fundingInstruments, $info);
    }
public function build(array $data)
    {
        $this->validateArrayKeys(
            array('payment_method'),
            $data
        );

        if ( ! in_array($data['payment_method'], array('credit_card', 'paypal'))) {

            throw new BuilderException('Parameter payment_method not valid. Allowed values: "credit_card" and "paypal"');
        }

        $fundingInstruments = array();
        if (isset($data['funding_instruments'])) {
            $fundingInstruments = $data['funding_instruments'];
        }

        $info = array();
        if (isset($data['payer_info'])) {
            $info = $data['payer_info'];
        }

        return new Payer($data['payment_method'], $fundingInstruments, $info);
    }
public function build ( array $ data ) { $ this -> validateArrayKeys ( array ( 'payment_method' ) , $ data ) ; if ( ! in_array ( $ data [ 'payment_method' ] , array ( 'credit_card' , 'paypal' ) ) ) { throw new BuilderException ( 'Parameter payment_method not valid. Allowed values: "credit_card" and "paypal"' ) ; } $ fundingInstruments = array ( ) ; if ( isset ( $ data [ 'funding_instruments' ] ) ) { $ fundingInstruments = $ data [ 'funding_instruments' ] ; } $ info = array ( ) ; if ( isset ( $ data [ 'payer_info' ] ) ) { $ info = $ data [ 'payer_info' ] ; } return new Payer ( $ data [ 'payment_method' ] , $ fundingInstruments , $ info ) ; }
Build an instance of PayPalRestApiClient\Model\Payer given an array

@param array $data The array should contains the payment_method following

@return PayPalRestApiClient\Model\Payer

@throws PayPalRestApiClient\Exception\BuilderException

@see https://developer.paypal.com/docs/api/#payer-object
Build an instance of PayPalRestApiClient \ Model \ Payer given an array