@@ -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,9 +57,9 @@ 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 | $rejection = Rejection::findByEmail($email_address); |
62 | - if($rejection){ |
|
62 | + if ($rejection) { |
|
63 | 63 | return true; |
64 | 64 | } |
65 | 65 | return false; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param string $email_address |
72 | 72 | * @return Rejection[] |
73 | 73 | */ |
74 | - public static function findHardBounces($email_address){ |
|
74 | + public static function findHardBounces($email_address) { |
|
75 | 75 | return Rejection::find() |
76 | 76 | ->andWhere(['email_address'=>$email_address]) |
77 | 77 | |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | * @param string $code |
85 | 85 | * @return bool |
86 | 86 | */ |
87 | - public static function rejectedByCode($code){ |
|
87 | + public static function rejectedByCode($code) { |
|
88 | 88 | $respondent = Respondent::findByToken($code); |
89 | - if($respondent){ |
|
89 | + if ($respondent) { |
|
90 | 90 | $rejections = self::find() |
91 | 91 | ->andWhere(['respondent_id'=>$respondent->primaryKey]) |
92 | 92 | ->all(); |
93 | - if($rejections){ |
|
93 | + if ($rejections) { |
|
94 | 94 | return true; |
95 | 95 | } |
96 | 96 | } |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | * @param string $type |
104 | 104 | * @return bool |
105 | 105 | */ |
106 | - public static function bouncedByEmailAddress($email_address,$type = self::BOUNCE_TYPE_HARD){ |
|
106 | + public static function bouncedByEmailAddress($email_address, $type = self::BOUNCE_TYPE_HARD) { |
|
107 | 107 | $rejections = self::find() |
108 | 108 | ->andWhere('email_address=:email_address', [':email_address' => $email_address]) |
109 | 109 | ->andWhere('type=:type', [':type' => $type]) |
110 | 110 | ->all(); |
111 | - if($rejections){ |
|
111 | + if ($rejections) { |
|
112 | 112 | return true; |
113 | 113 | } |
114 | 114 | return false; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @param string $email_address |
119 | 119 | * @return Rejection |
120 | 120 | */ |
121 | - public static function findByEmail($email_address){ |
|
121 | + public static function findByEmail($email_address) { |
|
122 | 122 | return Rejection::findOne(['email_address'=>$email_address]); |
123 | 123 | } |
124 | 124 | |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | return $this->hasOne(Respondent::class, ['respondent_id' => 'respondent_id']); |
139 | 139 | } |
140 | 140 | |
141 | - public static function getBounceTypes(){ |
|
141 | + public static function getBounceTypes() { |
|
142 | 142 | return [ |
143 | - self::BOUNCE_TYPE_COMPLAINT => Yii::t('app','Complaint'), |
|
144 | - self::BOUNCE_TYPE_SOFT => Yii::t('app','Soft bounce'), |
|
145 | - self::BOUNCE_TYPE_HARD => Yii::t('app','Hard bounce'), |
|
146 | - self::BOUNCE_TYPE_ANSWERED => Yii::t('app','Respondent has answered already'), |
|
147 | - self::BOUNCE_TYPE_OTHER => Yii::t('app','Other'), |
|
143 | + self::BOUNCE_TYPE_COMPLAINT => Yii::t('app', 'Complaint'), |
|
144 | + self::BOUNCE_TYPE_SOFT => Yii::t('app', 'Soft bounce'), |
|
145 | + self::BOUNCE_TYPE_HARD => Yii::t('app', 'Hard bounce'), |
|
146 | + self::BOUNCE_TYPE_ANSWERED => Yii::t('app', 'Respondent has answered already'), |
|
147 | + self::BOUNCE_TYPE_OTHER => Yii::t('app', 'Other'), |
|
148 | 148 | ]; |
149 | 149 | } |
150 | 150 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | class m170302_104953_create_rejections extends Migration |
6 | 6 | { |
7 | - private $tableName ='rejection'; |
|
7 | + private $tableName = 'rejection'; |
|
8 | 8 | |
9 | 9 | |
10 | 10 | public function safeUp() |
@@ -21,17 +21,17 @@ discard block |
||
21 | 21 | 'time_rejected' => $this->dateTime()->notNull()->comment('Rejection time'), |
22 | 22 | ]); |
23 | 23 | |
24 | - $this->addForeignKey('fk_rejection_survey_id',$this->tableName,'survey_id','survey','survey_id'); |
|
25 | - $this->addForeignKey('fk_rejection_respondent_id','rejection','respondent_id','respondent','respondent_id'); |
|
24 | + $this->addForeignKey('fk_rejection_survey_id', $this->tableName, 'survey_id', 'survey', 'survey_id'); |
|
25 | + $this->addForeignKey('fk_rejection_respondent_id', 'rejection', 'respondent_id', 'respondent', 'respondent_id'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function safeDown() |
31 | 31 | { |
32 | - $this->dropForeignKey('fk_rejection_survey_id',$this->tableName); |
|
33 | - $this->dropForeignKey('fk_rejection_email_id',$this->tableName); |
|
34 | - $this->dropForeignKey('fk_rejection_respondent_id',$this->tableName); |
|
32 | + $this->dropForeignKey('fk_rejection_survey_id', $this->tableName); |
|
33 | + $this->dropForeignKey('fk_rejection_email_id', $this->tableName); |
|
34 | + $this->dropForeignKey('fk_rejection_respondent_id', $this->tableName); |
|
35 | 35 | $this->dropTable($this->tableName); |
36 | 36 | } |
37 | 37 | } |
@@ -6,12 +6,12 @@ |
||
6 | 6 | { |
7 | 7 | public function safeUp() |
8 | 8 | { |
9 | - $this->dropColumn('rejection','response_code'); |
|
9 | + $this->dropColumn('rejection', 'response_code'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | public function safeDown() |
13 | 13 | { |
14 | - $this->addColumn('rejection','response_code',$this->integer(4)->after('type') |
|
14 | + $this->addColumn('rejection', 'response_code', $this->integer(4)->after('type') |
|
15 | 15 | ->comment('Email response code in case of bounce')); |
16 | 16 | } |
17 | 17 | } |
@@ -6,11 +6,11 @@ |
||
6 | 6 | { |
7 | 7 | public function safeUp() |
8 | 8 | { |
9 | - $this->renameColumn('rejection','bounce_type','type'); |
|
9 | + $this->renameColumn('rejection', 'bounce_type', 'type'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | public function safeDown() |
13 | 13 | { |
14 | - $this->renameColumn('rejection','type','bounce_type'); |
|
14 | + $this->renameColumn('rejection', 'type', 'bounce_type'); |
|
15 | 15 | } |
16 | 16 | } |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | * @param string $status if not set Status will be taken from Email |
39 | 39 | * @return boolean |
40 | 40 | */ |
41 | - public static function create($survey,$status = null){ |
|
41 | + public static function create($survey, $status = null) { |
|
42 | 42 | $model = new static(); |
43 | 43 | $model->survey_id = $survey->primaryKey; |
44 | - $model->status =$survey->status; |
|
45 | - if($status){ |
|
46 | - $model->status =$status; |
|
44 | + $model->status = $survey->status; |
|
45 | + if ($status) { |
|
46 | + $model->status = $status; |
|
47 | 47 | } |
48 | 48 | return $model->save(); |
49 | 49 | } |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | public function rules() |
55 | 55 | { |
56 | 56 | return array_merge([ |
57 | - [['survey_id','status'], 'required'], |
|
57 | + [['survey_id', 'status'], 'required'], |
|
58 | 58 | [['status'], 'string', 'max' => 32], |
59 | 59 | [['survey_id'], 'integer'], |
60 | - ], parent::rules()); |
|
60 | + ], parent::rules()); |
|
61 | 61 | } |
62 | 62 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public static function modelName() |
36 | 36 | { |
37 | - return Yii::t('app','Rating'); |
|
37 | + return Yii::t('app', 'Rating'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | [['respondent_id', 'survey_id', 'sample_id', 'value'], 'integer'], |
50 | 50 | [['comment'], 'string'], |
51 | 51 | [['respondent_id'], 'exist', 'skipOnError' => true, 'targetClass' => Respondent::class, 'targetAttribute' => ['respondent_id' => 'respondent_id']], |
52 | - ], parent::rules()); |
|
52 | + ], parent::rules()); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | public function rules() |
31 | 31 | { |
32 | 32 | return array_merge([ |
33 | - [['name','status'], 'required'], |
|
33 | + [['name', 'status'], 'required'], |
|
34 | 34 | [['name', 'status'], 'string', 'max' => 255], |
35 | - [['name'], 'string','max' => 500], |
|
36 | - [['options'], 'string','max' => 1024 * 10], |
|
35 | + [['name'], 'string', 'max' => 500], |
|
36 | + [['options'], 'string', 'max' => 1024 * 10], |
|
37 | 37 | ], parent::rules()); |
38 | 38 | } |
39 | 39 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * @return mixed |
66 | 66 | */ |
67 | - public function getOptionsDecoded(){ |
|
67 | + public function getOptionsDecoded() { |
|
68 | 68 | return json_decode($this->options); |
69 | 69 | } |
70 | 70 |
@@ -185,7 +185,7 @@ |
||
185 | 185 | if ($i > static::MAX_ALTERNATIVE_CONTACTS) { |
186 | 186 | $this->addError($attribute, Yii::t('app', 'Maximum alternative phone numbers limit ({0}) reached for {1}', [static::MAX_ALTERNATIVE_CONTACTS, $this->phone_number])); |
187 | 187 | } |
188 | - $this->validatePhoneNumber($attribute, $item); |
|
188 | + $this->validatePhoneNumber($attribute, $item); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | $this->alternative_phone_numbers = yii\helpers\Json::encode($cleanItems); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $this->addError($attribute, Yii::t('app', 'Duplicate email in alternative email addresses')); |
143 | 143 | } |
144 | 144 | |
145 | - if ($i > static::MAX_ALTERNATIVE_CONTACTS) { |
|
145 | + if ($i>static::MAX_ALTERNATIVE_CONTACTS) { |
|
146 | 146 | $this->addError($attribute, Yii::t('app', 'Maximum alternative addresses limit ({0}) reached for {1}', [static::MAX_ALTERNATIVE_CONTACTS, $this->email_address])); |
147 | 147 | } |
148 | 148 | $address = strtolower(trim($address)); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $item = strtolower(trim($item)); |
183 | 183 | $this->validateAlternativePhoneNumberInternalDuplicates($attribute, $item, $key); |
184 | 184 | |
185 | - if ($i > static::MAX_ALTERNATIVE_CONTACTS) { |
|
185 | + if ($i>static::MAX_ALTERNATIVE_CONTACTS) { |
|
186 | 186 | $this->addError($attribute, Yii::t('app', 'Maximum alternative phone numbers limit ({0}) reached for {1}', [static::MAX_ALTERNATIVE_CONTACTS, $this->phone_number])); |
187 | 187 | } |
188 | 188 | $this->validatePhoneNumber($attribute, $item); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | $query->andWhere($condition, [':phone_number' => $phone_number, ':phone_number2' => '%\"' . $phone_number . '\"%']); |
249 | 249 | |
250 | - if ($query->count() > 0) { |
|
250 | + if ($query->count()>0) { |
|
251 | 251 | $this->addError($attribute, |
252 | 252 | Yii::t('app', |
253 | 253 | 'Invalid phone number "{0}"', [$phone_number] |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | $query->andWhere($email_condition, [':email_address' => $email_address, ':email_address2' => '%\"' . $email_address . '\"%']); |
282 | 282 | |
283 | - if ($query->count() > 0) { |
|
283 | + if ($query->count()>0) { |
|
284 | 284 | $this->addError($attribute, |
285 | 285 | Yii::t('app', |
286 | 286 | 'Invalid email address "{0}"', [$email_address] |
@@ -386,14 +386,14 @@ discard block |
||
386 | 386 | $query->createCommand() |
387 | 387 | ->update(self::tableName(), |
388 | 388 | [$field=> $dateHelper->getDatetime6()], |
389 | - ['in','token',$tokens] |
|
389 | + ['in', 'token', $tokens] |
|
390 | 390 | )->execute(); |
391 | 391 | } |
392 | 392 | |
393 | 393 | /** |
394 | 394 | * @return array |
395 | 395 | */ |
396 | - public function getParticipantData(){ |
|
396 | + public function getParticipantData() { |
|
397 | 397 | return []; |
398 | 398 | } |
399 | 399 |