private function getPayloadModel(ContactClient $contactClient = null)
    {
        if (!$this->payloadModel || $contactClient) {
            $contactClient = $contactClient ? $contactClient : $this->contactClient;
            $clientType    = $contactClient->getType();
            if ('api' == $clientType) {
                $model = $this->getApiPayloadModel();
            } elseif ('file' == $clientType) {
                $model = $this->getFilePayloadModel();
            } else {
                throw new \InvalidArgumentException('Client type is invalid.');
            }
            $model->reset();
            $model->setTest($this->test);
            $model->setContactClient($contactClient);
            if ($this->contact) {
                $model->setContact($this->contact);
            }
            $this->payloadModel = $model;
        }

        return $this->payloadModel;
    }
private function getPayloadModel(ContactClient $contactClient = null)
    {
        if (!$this->payloadModel || $contactClient) {
            $contactClient = $contactClient ? $contactClient : $this->contactClient;
            $clientType    = $contactClient->getType();
            if ('api' == $clientType) {
                $model = $this->getApiPayloadModel();
            } elseif ('file' == $clientType) {
                $model = $this->getFilePayloadModel();
            } else {
                throw new \InvalidArgumentException('Client type is invalid.');
            }
            $model->reset();
            $model->setTest($this->test);
            $model->setContactClient($contactClient);
            if ($this->contact) {
                $model->setContact($this->contact);
            }
            $this->payloadModel = $model;
        }

        return $this->payloadModel;
    }
private function getPayloadModel ( ContactClient $ contactClient = null ) { if ( ! $ this -> payloadModel || $ contactClient ) { $ contactClient = $ contactClient ? $ contactClient : $ this -> contactClient ; $ clientType = $ contactClient -> getType ( ) ; if ( 'api' == $ clientType ) { $ model = $ this -> getApiPayloadModel ( ) ; } elseif ( 'file' == $ clientType ) { $ model = $ this -> getFilePayloadModel ( ) ; } else { throw new \ InvalidArgumentException ( 'Client type is invalid.' ) ; } $ model -> reset ( ) ; $ model -> setTest ( $ this -> test ) ; $ model -> setContactClient ( $ contactClient ) ; if ( $ this -> contact ) { $ model -> setContact ( $ this -> contact ) ; } $ this -> payloadModel = $ model ; } return $ this -> payloadModel ; }
Get the current Payload model, or the model of a particular client.

@param ContactClient|null $contactClient

@return ApiPayload|FilePayload|object

@throws ContactClientException
Get the current Payload model or the model of a particular client .