public function __construct(Payload $payload)
 {
     parent::__construct($payload);
     if (!$this->isSuccess()) {
         switch ($this->getMessageType()) {
             default:
                 throw new Exception($this, $this->getMessageText());
         }
     }
 }
 public function __construct(Payload $payload)
 {
     parent::__construct($payload);
     if ($this->isSuccess()) {
         if (!empty($this->data[static::FIELD_DATA])) {
             foreach ($this->data[static::FIELD_DATA] as $object) {
                 $this->trades[] = new RegularTrade($object);
             }
         }
     }
 }
 public function __construct(Payload $payload)
 {
     parent::__construct($payload);
     if ($this->isSuccess()) {
         if (!empty($this->data[static::FIELD_DATA])) {
             foreach ($this->data[static::FIELD_DATA] as $languageInfo) {
                 $this->languages[] = new Language($languageInfo[static::FIELD_LCID], $languageInfo[static::FIELD_ENGLISH_NAME], $languageInfo[static::FIELD_NATIVE_NAME]);
             }
         }
     }
 }
 public function __construct(Payload $payload)
 {
     parent::__construct($payload);
     if ($this->isSuccess()) {
         if (!empty($this->data[static::FIELD_DATA])) {
             foreach ($this->data[static::FIELD_DATA] as $depositInfo) {
                 $this->deposits[] = new Deposit($depositInfo);
             }
         }
     }
 }
 public function __construct(Payload $payload)
 {
     parent::__construct($payload);
     if (!$this->isSuccess()) {
         switch ($this->getMessageType()) {
             case static::ERROR_EMAIL_EXISTS:
                 throw new EmailAlreadyExistsException($this, $this->getMessageText());
             default:
                 throw new Exception($this, $this->getMessageText());
         }
     }
 }
 public function __construct(Payload $payload)
 {
     parent::__construct($payload);
     if ($this->isSuccess()) {
         if (!empty($this->data[static::FIELD_DATA])) {
             foreach ($this->data[static::FIELD_DATA] as $countryInfo) {
                 // Two countries from TradoLogic API have not currency.
                 // These countries: "Unknown" and "Antarctica". Real "Tear 1" countries with fat traffic of penguins and nobodies...
                 // But we should skip them...
                 if (isset($countryInfo[static::FIELD_CURRENCY]) && $countryInfo[static::FIELD_CURRENCY]) {
                     $this->countries[] = new Country($countryInfo);
                 }
             }
         }
     }
 }