@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | [['type'], 'string', 'max' => 45], |
| 57 | 57 | [['respondent_id'], 'exist', 'skipOnError' => true, 'targetClass' => Respondent::class, 'targetAttribute' => ['respondent_id' => 'respondent_id']], |
| 58 | 58 | [['survey_id'], 'exist', 'skipOnError' => true, 'targetClass' => Survey::class, 'targetAttribute' => ['survey_id' => 'survey_id']], |
| 59 | - ], parent::rules()); |
|
| 59 | + ], parent::rules()); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @param string $email_address |
| 65 | 65 | * @return bool |
| 66 | 66 | */ |
| 67 | - public static function hasBouncedHard($email_address){ |
|
| 67 | + public static function hasBouncedHard($email_address) { |
|
| 68 | 68 | return (!empty(self::findHardBounces($email_address))); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param string $email_address |
| 75 | 75 | * @return Rejection[] |
| 76 | 76 | */ |
| 77 | - public static function findHardBounces($email_address){ |
|
| 77 | + public static function findHardBounces($email_address) { |
|
| 78 | 78 | return Rejection::find() |
| 79 | 79 | ->andWhere(['email_address'=>$email_address, 'type' => self::BOUNCE_TYPE_HARD]) |
| 80 | 80 | ->all(); |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | * @param string $code |
| 87 | 87 | * @return bool |
| 88 | 88 | */ |
| 89 | - public static function rejectedByCode($code){ |
|
| 89 | + public static function rejectedByCode($code) { |
|
| 90 | 90 | $respondent = Respondent::findByToken($code); |
| 91 | - if($respondent){ |
|
| 91 | + if ($respondent) { |
|
| 92 | 92 | $rejections = self::find() |
| 93 | 93 | ->andWhere(['respondent_id'=>$respondent->primaryKey]) |
| 94 | 94 | ->all(); |
| 95 | - if($rejections){ |
|
| 95 | + if ($rejections) { |
|
| 96 | 96 | return true; |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | * @param string $type |
| 106 | 106 | * @return bool |
| 107 | 107 | */ |
| 108 | - public static function bouncedByEmailAddress($email_address,$type = self::BOUNCE_TYPE_HARD){ |
|
| 108 | + public static function bouncedByEmailAddress($email_address, $type = self::BOUNCE_TYPE_HARD) { |
|
| 109 | 109 | $rejections = self::find() |
| 110 | 110 | ->andWhere('email_address=:email_address', [':email_address' => $email_address]) |
| 111 | 111 | ->andWhere('type=:type', [':type' => $type]) |
| 112 | 112 | ->all(); |
| 113 | - if($rejections){ |
|
| 113 | + if ($rejections) { |
|
| 114 | 114 | return true; |
| 115 | 115 | } |
| 116 | 116 | return false; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @param string $email_address |
| 121 | 121 | * @return Rejection |
| 122 | 122 | */ |
| 123 | - public static function findByEmail($email_address){ |
|
| 123 | + public static function findByEmail($email_address) { |
|
| 124 | 124 | return Rejection::findOne(['email_address'=>$email_address]); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | return $this->hasOne($this->respondentClass, ['respondent_id' => 'respondent_id']); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - public static function getBounceTypes(){ |
|
| 143 | + public static function getBounceTypes() { |
|
| 144 | 144 | return [ |
| 145 | - self::BOUNCE_TYPE_COMPLAINT => Yii::t('app','Complaint'), |
|
| 146 | - self::BOUNCE_TYPE_SOFT => Yii::t('app','Soft bounce'), |
|
| 147 | - self::BOUNCE_TYPE_HARD => Yii::t('app','Hard bounce'), |
|
| 148 | - self::BOUNCE_TYPE_ANSWERED => Yii::t('app','Respondent has answered already'), |
|
| 149 | - self::BOUNCE_TYPE_OTHER => Yii::t('app','Other'), |
|
| 145 | + self::BOUNCE_TYPE_COMPLAINT => Yii::t('app', 'Complaint'), |
|
| 146 | + self::BOUNCE_TYPE_SOFT => Yii::t('app', 'Soft bounce'), |
|
| 147 | + self::BOUNCE_TYPE_HARD => Yii::t('app', 'Hard bounce'), |
|
| 148 | + self::BOUNCE_TYPE_ANSWERED => Yii::t('app', 'Respondent has answered already'), |
|
| 149 | + self::BOUNCE_TYPE_OTHER => Yii::t('app', 'Other'), |
|
| 150 | 150 | ]; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -165,10 +165,10 @@ discard block |
||
| 165 | 165 | public function getBounceReason() |
| 166 | 166 | { |
| 167 | 167 | if (!empty($this->bounceObject)) { |
| 168 | - if(isset($this->bounceObject->diagnosticcode)) { |
|
| 168 | + if (isset($this->bounceObject->diagnosticcode)) { |
|
| 169 | 169 | return $this->bounceObject->diagnosticcode; |
| 170 | 170 | } |
| 171 | - if(isset($this->bounceObject->reason)) { |
|
| 171 | + if (isset($this->bounceObject->reason)) { |
|
| 172 | 172 | return $this->bounceObject->reason; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | public function getBounceReplyCode() |
| 182 | 182 | { |
| 183 | 183 | if (!empty($this->bounceObject)) { |
| 184 | - if(isset($this->bounceObject->deliverystatus)) { |
|
| 184 | + if (isset($this->bounceObject->deliverystatus)) { |
|
| 185 | 185 | return $this->bounceObject->deliverystatus; |
| 186 | 186 | } |
| 187 | 187 | } |