@@ -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); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $this->addError($attribute, Yii::t('app', 'Duplicate email in alternative email addresses')); |
147 | 147 | } |
148 | 148 | |
149 | - if ($i > static::MAX_ALTERNATIVE_CONTACTS) { |
|
149 | + if ($i>static::MAX_ALTERNATIVE_CONTACTS) { |
|
150 | 150 | $this->addError($attribute, Yii::t('app', 'Maximum alternative addresses limit ({0}) reached for {1}', [static::MAX_ALTERNATIVE_CONTACTS, $this->email_address])); |
151 | 151 | } |
152 | 152 | $address = strtolower(trim($address)); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $item = strtolower(trim($item)); |
188 | 188 | $this->validateAlternativePhoneNumberInternalDuplicates($attribute, $item, $key); |
189 | 189 | |
190 | - if ($i > static::MAX_ALTERNATIVE_CONTACTS) { |
|
190 | + if ($i>static::MAX_ALTERNATIVE_CONTACTS) { |
|
191 | 191 | $this->addError($attribute, Yii::t('app', 'Maximum alternative phone numbers limit ({0}) reached for {1}', [static::MAX_ALTERNATIVE_CONTACTS, $this->phone_number])); |
192 | 192 | } |
193 | 193 | $this->validatePhoneNumber($attribute, $item); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | $query->andWhere($condition, [':phone_number' => $phone_number, ':phone_number2' => '%\"' . $phone_number . '\"%']); |
254 | 254 | |
255 | - if ($query->count() > 0) { |
|
255 | + if ($query->count()>0) { |
|
256 | 256 | $this->addError($attribute, |
257 | 257 | Yii::t('app', |
258 | 258 | 'Invalid phone number "{0}"', [$phone_number] |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | $query->andWhere($email_condition, [':email_address' => $email_address, ':email_address2' => '%\"' . $email_address . '\"%']); |
287 | 287 | |
288 | - if ($query->count() > 0) { |
|
288 | + if ($query->count()>0) { |
|
289 | 289 | $this->addError($attribute, |
290 | 290 | Yii::t('app', |
291 | 291 | 'Invalid email address "{0}"', [$email_address] |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | ->andWhere(['respondent_id'=>$this->primaryKey]) |
364 | 364 | // only rejections, not bounces |
365 | 365 | ->andWhere(['is', 'bounce', null]); |
366 | - return $rejections->count() > 0; |
|
366 | + return $rejections->count()>0; |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -405,14 +405,14 @@ discard block |
||
405 | 405 | return $query->createCommand() |
406 | 406 | ->update(self::tableName(), |
407 | 407 | [$field=> $dateHelper->getDatetime6()], |
408 | - ['in','token',$tokens] |
|
408 | + ['in', 'token', $tokens] |
|
409 | 409 | )->execute(); |
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
413 | 413 | * @return array |
414 | 414 | */ |
415 | - public function getParticipantData(){ |
|
415 | + public function getParticipantData() { |
|
416 | 416 | return []; |
417 | 417 | } |
418 | 418 |
@@ -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,18 +86,18 @@ discard block |
||
86 | 86 | * @param string $type |
87 | 87 | * @return bool |
88 | 88 | */ |
89 | - public static function bouncedByEmailAddress($email_address,$type = self::BOUNCE_TYPE_HARD){ |
|
89 | + public static function bouncedByEmailAddress($email_address, $type = self::BOUNCE_TYPE_HARD) { |
|
90 | 90 | $rejections = self::find() |
91 | 91 | ->andWhere('email_address=:email_address', [':email_address' => $email_address]) |
92 | 92 | ->andWhere('type=:type', [':type' => $type]); |
93 | - return $rejections->count() > 0; |
|
93 | + return $rejections->count()>0; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | 97 | * @param string $email_address |
98 | 98 | * @return Rejection |
99 | 99 | */ |
100 | - public static function findByEmail($email_address){ |
|
100 | + public static function findByEmail($email_address) { |
|
101 | 101 | return Rejection::findOne(['email_address'=>$email_address]); |
102 | 102 | } |
103 | 103 | |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | return $this->hasOne($this->respondentClass, ['respondent_id' => 'respondent_id']); |
118 | 118 | } |
119 | 119 | |
120 | - public static function getBounceTypes(){ |
|
120 | + public static function getBounceTypes() { |
|
121 | 121 | return [ |
122 | - self::BOUNCE_TYPE_COMPLAINT => Yii::t('app','Complaint'), |
|
123 | - self::BOUNCE_TYPE_SOFT => Yii::t('app','Soft bounce'), |
|
124 | - self::BOUNCE_TYPE_HARD => Yii::t('app','Hard bounce'), |
|
125 | - self::BOUNCE_TYPE_ANSWERED => Yii::t('app','Respondent has answered already'), |
|
126 | - self::BOUNCE_TYPE_OTHER => Yii::t('app','Other'), |
|
122 | + self::BOUNCE_TYPE_COMPLAINT => Yii::t('app', 'Complaint'), |
|
123 | + self::BOUNCE_TYPE_SOFT => Yii::t('app', 'Soft bounce'), |
|
124 | + self::BOUNCE_TYPE_HARD => Yii::t('app', 'Hard bounce'), |
|
125 | + self::BOUNCE_TYPE_ANSWERED => Yii::t('app', 'Respondent has answered already'), |
|
126 | + self::BOUNCE_TYPE_OTHER => Yii::t('app', 'Other'), |
|
127 | 127 | ]; |
128 | 128 | } |
129 | 129 | |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | return null; |
146 | 146 | } |
147 | 147 | |
148 | - if(isset($this->bounceObject->diagnosticcode)) { |
|
148 | + if (isset($this->bounceObject->diagnosticcode)) { |
|
149 | 149 | return $this->bounceObject->diagnosticcode; |
150 | 150 | } |
151 | - if(isset($this->bounceObject->reason)) { |
|
151 | + if (isset($this->bounceObject->reason)) { |
|
152 | 152 | return $this->bounceObject->reason; |
153 | 153 | } |
154 | 154 | return null; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return null; |
164 | 164 | } |
165 | 165 | |
166 | - if(isset($this->bounceObject->deliverystatus)) { |
|
166 | + if (isset($this->bounceObject->deliverystatus)) { |
|
167 | 167 | return $this->bounceObject->deliverystatus; |
168 | 168 | } |
169 | 169 |