@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | [['type'], 'string', 'max' => 45], |
| 53 | 53 | [['respondent_id'], 'exist', 'skipOnError' => true, 'targetClass' => Respondent::class, 'targetAttribute' => ['respondent_id' => 'respondent_id']], |
| 54 | 54 | [['survey_id'], 'exist', 'skipOnError' => true, 'targetClass' => Survey::class, 'targetAttribute' => ['survey_id' => 'survey_id']], |
| 55 | - ], parent::rules()); |
|
| 55 | + ], parent::rules()); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param string $email_address |
| 61 | 61 | * @return bool |
| 62 | 62 | */ |
| 63 | - public static function hasBouncedHard($email_address){ |
|
| 63 | + public static function hasBouncedHard($email_address) { |
|
| 64 | 64 | return (!empty(self::findHardBounces($email_address))); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @param string $email_address |
| 71 | 71 | * @return Rejection[] |
| 72 | 72 | */ |
| 73 | - public static function findHardBounces($email_address){ |
|
| 73 | + public static function findHardBounces($email_address) { |
|
| 74 | 74 | return Rejection::find() |
| 75 | 75 | ->andWhere(['email_address'=>$email_address, 'type' => self::BOUNCE_TYPE_HARD]) |
| 76 | 76 | ->all(); |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | * @param string $code |
| 83 | 83 | * @return bool |
| 84 | 84 | */ |
| 85 | - public static function rejectedByCode($code){ |
|
| 85 | + public static function rejectedByCode($code) { |
|
| 86 | 86 | $respondent = Respondent::findByToken($code); |
| 87 | - if($respondent){ |
|
| 87 | + if ($respondent) { |
|
| 88 | 88 | $rejections = self::find() |
| 89 | 89 | ->andWhere(['respondent_id'=>$respondent->primaryKey]) |
| 90 | 90 | ->all(); |
| 91 | - if($rejections){ |
|
| 91 | + if ($rejections) { |
|
| 92 | 92 | return true; |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | * @param string $type |
| 102 | 102 | * @return bool |
| 103 | 103 | */ |
| 104 | - public static function bouncedByEmailAddress($email_address,$type = self::BOUNCE_TYPE_HARD){ |
|
| 104 | + public static function bouncedByEmailAddress($email_address, $type = self::BOUNCE_TYPE_HARD) { |
|
| 105 | 105 | $rejections = self::find() |
| 106 | 106 | ->andWhere('email_address=:email_address', [':email_address' => $email_address]) |
| 107 | 107 | ->andWhere('type=:type', [':type' => $type]) |
| 108 | 108 | ->all(); |
| 109 | - if($rejections){ |
|
| 109 | + if ($rejections) { |
|
| 110 | 110 | return true; |
| 111 | 111 | } |
| 112 | 112 | return false; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @param string $email_address |
| 117 | 117 | * @return Rejection |
| 118 | 118 | */ |
| 119 | - public static function findByEmail($email_address){ |
|
| 119 | + public static function findByEmail($email_address) { |
|
| 120 | 120 | return Rejection::findOne(['email_address'=>$email_address]); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | return $this->hasOne(Respondent::class, ['respondent_id' => 'respondent_id']); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - public static function getBounceTypes(){ |
|
| 139 | + public static function getBounceTypes() { |
|
| 140 | 140 | return [ |
| 141 | - self::BOUNCE_TYPE_COMPLAINT => Yii::t('app','Complaint'), |
|
| 142 | - self::BOUNCE_TYPE_SOFT => Yii::t('app','Soft bounce'), |
|
| 143 | - self::BOUNCE_TYPE_HARD => Yii::t('app','Hard bounce'), |
|
| 144 | - self::BOUNCE_TYPE_ANSWERED => Yii::t('app','Respondent has answered already'), |
|
| 145 | - self::BOUNCE_TYPE_OTHER => Yii::t('app','Other'), |
|
| 141 | + self::BOUNCE_TYPE_COMPLAINT => Yii::t('app', 'Complaint'), |
|
| 142 | + self::BOUNCE_TYPE_SOFT => Yii::t('app', 'Soft bounce'), |
|
| 143 | + self::BOUNCE_TYPE_HARD => Yii::t('app', 'Hard bounce'), |
|
| 144 | + self::BOUNCE_TYPE_ANSWERED => Yii::t('app', 'Respondent has answered already'), |
|
| 145 | + self::BOUNCE_TYPE_OTHER => Yii::t('app', 'Other'), |
|
| 146 | 146 | ]; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -161,10 +161,10 @@ discard block |
||
| 161 | 161 | public function getBounceReason() |
| 162 | 162 | { |
| 163 | 163 | if (!empty($this->bounceObject)) { |
| 164 | - if(isset($this->bounceObject->diagnosticcode)) { |
|
| 164 | + if (isset($this->bounceObject->diagnosticcode)) { |
|
| 165 | 165 | return $this->bounceObject->diagnosticcode; |
| 166 | 166 | } |
| 167 | - if(isset($this->bounceObject->reason)) { |
|
| 167 | + if (isset($this->bounceObject->reason)) { |
|
| 168 | 168 | return $this->bounceObject->reason; |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | public function getBounceReplyCode() |
| 178 | 178 | { |
| 179 | 179 | if (!empty($this->bounceObject)) { |
| 180 | - if(isset($this->bounceObject->deliverystatus)) { |
|
| 180 | + if (isset($this->bounceObject->deliverystatus)) { |
|
| 181 | 181 | return $this->bounceObject->deliverystatus; |
| 182 | 182 | } |
| 183 | 183 | } |