@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | return array_merge([ |
| 43 | 43 | [['survey_id', 'respondent_id'], 'integer'], |
| 44 | - [['email_address','time_rejected'], 'required'], |
|
| 44 | + [['email_address', 'time_rejected'], 'required'], |
|
| 45 | 45 | [['bounce'], 'string'], |
| 46 | 46 | [['time_rejected'], 'safe'], |
| 47 | 47 | [['email_address'], 'string', 'max' => 255], |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | [['type'], 'string', 'max' => 45], |
| 50 | 50 | [['respondent_id'], 'exist', 'skipOnError' => true, 'targetClass' => Respondent::class, 'targetAttribute' => ['respondent_id' => 'respondent_id']], |
| 51 | 51 | [['survey_id'], 'exist', 'skipOnError' => true, 'targetClass' => Survey::class, 'targetAttribute' => ['survey_id' => 'survey_id']], |
| 52 | - ], parent::rules()); |
|
| 52 | + ], parent::rules()); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param string $email_address |
| 58 | 58 | * @return bool |
| 59 | 59 | */ |
| 60 | - public static function hasBouncedHard($email_address){ |
|
| 60 | + public static function hasBouncedHard($email_address) { |
|
| 61 | 61 | return (!empty(self::findHardBounces($email_address))); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @param string $email_address |
| 68 | 68 | * @return Rejection[] |
| 69 | 69 | */ |
| 70 | - public static function findHardBounces($email_address){ |
|
| 70 | + public static function findHardBounces($email_address) { |
|
| 71 | 71 | return Rejection::find() |
| 72 | 72 | ->andWhere(['email_address'=>$email_address, 'type' => self::BOUNCE_TYPE_HARD]) |
| 73 | 73 | ->all(); |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | * @param string $code |
| 80 | 80 | * @return bool |
| 81 | 81 | */ |
| 82 | - public static function rejectedByCode($code){ |
|
| 82 | + public static function rejectedByCode($code) { |
|
| 83 | 83 | $respondent = Respondent::findByToken($code); |
| 84 | - if($respondent){ |
|
| 84 | + if ($respondent) { |
|
| 85 | 85 | $rejections = self::find() |
| 86 | 86 | ->andWhere(['respondent_id'=>$respondent->primaryKey]) |
| 87 | 87 | ->all(); |
| 88 | - if($rejections){ |
|
| 88 | + if ($rejections) { |
|
| 89 | 89 | return true; |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | * @param string $type |
| 99 | 99 | * @return bool |
| 100 | 100 | */ |
| 101 | - public static function bouncedByEmailAddress($email_address,$type = self::BOUNCE_TYPE_HARD){ |
|
| 101 | + public static function bouncedByEmailAddress($email_address, $type = self::BOUNCE_TYPE_HARD) { |
|
| 102 | 102 | $rejections = self::find() |
| 103 | 103 | ->andWhere('email_address=:email_address', [':email_address' => $email_address]) |
| 104 | 104 | ->andWhere('type=:type', [':type' => $type]) |
| 105 | 105 | ->all(); |
| 106 | - if($rejections){ |
|
| 106 | + if ($rejections) { |
|
| 107 | 107 | return true; |
| 108 | 108 | } |
| 109 | 109 | return false; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @param string $email_address |
| 114 | 114 | * @return Rejection |
| 115 | 115 | */ |
| 116 | - public static function findByEmail($email_address){ |
|
| 116 | + public static function findByEmail($email_address) { |
|
| 117 | 117 | return Rejection::findOne(['email_address'=>$email_address]); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | return $this->hasOne(Respondent::class, ['respondent_id' => 'respondent_id']); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - public static function getBounceTypes(){ |
|
| 136 | + public static function getBounceTypes() { |
|
| 137 | 137 | return [ |
| 138 | - self::BOUNCE_TYPE_COMPLAINT => Yii::t('app','Complaint'), |
|
| 139 | - self::BOUNCE_TYPE_SOFT => Yii::t('app','Soft bounce'), |
|
| 140 | - self::BOUNCE_TYPE_HARD => Yii::t('app','Hard bounce'), |
|
| 141 | - self::BOUNCE_TYPE_ANSWERED => Yii::t('app','Respondent has answered already'), |
|
| 142 | - self::BOUNCE_TYPE_OTHER => Yii::t('app','Other'), |
|
| 138 | + self::BOUNCE_TYPE_COMPLAINT => Yii::t('app', 'Complaint'), |
|
| 139 | + self::BOUNCE_TYPE_SOFT => Yii::t('app', 'Soft bounce'), |
|
| 140 | + self::BOUNCE_TYPE_HARD => Yii::t('app', 'Hard bounce'), |
|
| 141 | + self::BOUNCE_TYPE_ANSWERED => Yii::t('app', 'Respondent has answered already'), |
|
| 142 | + self::BOUNCE_TYPE_OTHER => Yii::t('app', 'Other'), |
|
| 143 | 143 | ]; |
| 144 | 144 | } |
| 145 | 145 | } |