You are here

public function GetAccount::__construct in SendinBlue 8

Same name and namespace in other branches
  1. 8.2 src/Tools/Model/GetAccount.php \Drupal\sendinblue\Tools\Model\GetAccount::__construct()

GetAccount constructor.

File

src/Tools/Model/GetAccount.php, line 34

Class

GetAccount

Namespace

Drupal\sendinblue\Tools\Model

Code

public function __construct(array $data = []) {
  $this
    ->setEmail($data['email']);
  $this
    ->setFirstName($data['firstName']);
  $this
    ->setLastName($data['lastName']);
  $this
    ->setCompanyName($data['companyName']);
  if (!empty($data['address'])) {
    $address = new GetExtendedClientAddress($data['address']);
    $this
      ->setAddress($address);
  }
  if (!empty($data['plan'])) {
    foreach ($data['plan'] as $plan) {
      $accountPlan = new GetAccountPlan($plan);
      $this
        ->addPlan($accountPlan);
    }
  }
}