@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | return array_merge([ |
| 45 | 45 | [['survey_id', 'respondent_id'], 'integer'], |
| 46 | - [['email_address','time_rejected'], 'required'], |
|
| 46 | + [['email_address', 'time_rejected'], 'required'], |
|
| 47 | 47 | [['bounce'], 'string'], |
| 48 | 48 | [['time_rejected'], 'safe'], |
| 49 | 49 | [['email_address'], 'string', 'max' => 255], |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | [['type'], 'string', 'max' => 45], |
| 52 | 52 | [['respondent_id'], 'exist', 'skipOnError' => true, 'targetClass' => Respondent::class, 'targetAttribute' => ['respondent_id' => 'respondent_id']], |
| 53 | 53 | [['survey_id'], 'exist', 'skipOnError' => true, 'targetClass' => Survey::class, 'targetAttribute' => ['survey_id' => 'survey_id']], |
| 54 | - ], parent::rules()); |
|
| 54 | + ], parent::rules()); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @param string $email_address |
| 60 | 60 | * @return bool |
| 61 | 61 | */ |
| 62 | - public static function hasBouncedHard($email_address){ |
|
| 62 | + public static function hasBouncedHard($email_address) { |
|
| 63 | 63 | return (!empty(self::findHardBounces($email_address))); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param string $email_address |
| 70 | 70 | * @return Rejection[] |
| 71 | 71 | */ |
| 72 | - public static function findHardBounces($email_address){ |
|
| 72 | + public static function findHardBounces($email_address) { |
|
| 73 | 73 | return Rejection::find() |
| 74 | 74 | ->andWhere(['email_address'=>$email_address, 'type' => self::BOUNCE_TYPE_HARD]) |
| 75 | 75 | ->all(); |
@@ -81,13 +81,13 @@ discard block |
||
| 81 | 81 | * @param string $code |
| 82 | 82 | * @return bool |
| 83 | 83 | */ |
| 84 | - public static function rejectedByCode($code){ |
|
| 84 | + public static function rejectedByCode($code) { |
|
| 85 | 85 | $respondent = Respondent::findByToken($code); |
| 86 | - if($respondent){ |
|
| 86 | + if ($respondent) { |
|
| 87 | 87 | $rejections = self::find() |
| 88 | 88 | ->andWhere(['respondent_id'=>$respondent->primaryKey]) |
| 89 | 89 | ->all(); |
| 90 | - if($rejections){ |
|
| 90 | + if ($rejections) { |
|
| 91 | 91 | return true; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | * @param string $type |
| 101 | 101 | * @return bool |
| 102 | 102 | */ |
| 103 | - public static function bouncedByEmailAddress($email_address,$type = self::BOUNCE_TYPE_HARD){ |
|
| 103 | + public static function bouncedByEmailAddress($email_address, $type = self::BOUNCE_TYPE_HARD) { |
|
| 104 | 104 | $rejections = self::find() |
| 105 | 105 | ->andWhere('email_address=:email_address', [':email_address' => $email_address]) |
| 106 | 106 | ->andWhere('type=:type', [':type' => $type]) |
| 107 | 107 | ->all(); |
| 108 | - if($rejections){ |
|
| 108 | + if ($rejections) { |
|
| 109 | 109 | return true; |
| 110 | 110 | } |
| 111 | 111 | return false; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param string $email_address |
| 116 | 116 | * @return Rejection |
| 117 | 117 | */ |
| 118 | - public static function findByEmail($email_address){ |
|
| 118 | + public static function findByEmail($email_address) { |
|
| 119 | 119 | return Rejection::findOne(['email_address'=>$email_address]); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -135,13 +135,13 @@ discard block |
||
| 135 | 135 | return $this->hasOne(Respondent::class, ['respondent_id' => 'respondent_id']); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - public static function getBounceTypes(){ |
|
| 138 | + public static function getBounceTypes() { |
|
| 139 | 139 | return [ |
| 140 | - self::BOUNCE_TYPE_COMPLAINT => Yii::t('app','Complaint'), |
|
| 141 | - self::BOUNCE_TYPE_SOFT => Yii::t('app','Soft bounce'), |
|
| 142 | - self::BOUNCE_TYPE_HARD => Yii::t('app','Hard bounce'), |
|
| 143 | - self::BOUNCE_TYPE_ANSWERED => Yii::t('app','Respondent has answered already'), |
|
| 144 | - self::BOUNCE_TYPE_OTHER => Yii::t('app','Other'), |
|
| 140 | + self::BOUNCE_TYPE_COMPLAINT => Yii::t('app', 'Complaint'), |
|
| 141 | + self::BOUNCE_TYPE_SOFT => Yii::t('app', 'Soft bounce'), |
|
| 142 | + self::BOUNCE_TYPE_HARD => Yii::t('app', 'Hard bounce'), |
|
| 143 | + self::BOUNCE_TYPE_ANSWERED => Yii::t('app', 'Respondent has answered already'), |
|
| 144 | + self::BOUNCE_TYPE_OTHER => Yii::t('app', 'Other'), |
|
| 145 | 145 | ]; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | public function getBounceReason() |
| 158 | 158 | { |
| 159 | 159 | if (!empty($this->bounceObject)) { |
| 160 | - if(isset($this->bounceObject->diagnosticcode)) { |
|
| 160 | + if (isset($this->bounceObject->diagnosticcode)) { |
|
| 161 | 161 | return $this->bounceObject->diagnosticcode; |
| 162 | 162 | } |
| 163 | 163 | } |