Passed
Push — master ( 39e7ce...573e3b )
by Tõnis
03:33
created
src/migrations/m170302_104953_create_rejections.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/migrations/m170329_072118_remove_response_code_from_rejection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/migrations/m170327_130608_rename_rejection_type.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/SurveyHasStatus.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Rating.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/Survey.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Respondent.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                         $this->addError($attribute, Yii::t('app', 'Duplicate email in alternative email addresses'));
144 144
                     }
145 145
 
146
-                    if ($i > static::MAX_ALTERNATIVE_CONTACTS) {
146
+                    if ($i>static::MAX_ALTERNATIVE_CONTACTS) {
147 147
                         $this->addError($attribute, Yii::t('app', 'Maximum alternative addresses limit ({0}) reached for {1}', [static::MAX_ALTERNATIVE_CONTACTS, $this->email_address]));
148 148
                     }
149 149
                     $address = strtolower(trim($address));
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 $item = strtolower(trim($item));
185 185
                 $this->validateAlternativePhoneNumberInternalDuplicates($attribute, $item, $key);
186 186
 
187
-                if ($i > static::MAX_ALTERNATIVE_CONTACTS) {
187
+                if ($i>static::MAX_ALTERNATIVE_CONTACTS) {
188 188
                     $this->addError($attribute, Yii::t('app', 'Maximum alternative phone numbers limit ({0}) reached for {1}', [static::MAX_ALTERNATIVE_CONTACTS, $this->phone_number]));
189 189
                 }
190 190
                $this->validatePhoneNumber($attribute, $item);
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
         $query->andWhere($condition, [':phone_number' => $phone_number, ':phone_number2' => '%\"' . $phone_number . '\"%']);
251 251
 
252
-        if ($query->count() > 0) {
252
+        if ($query->count()>0) {
253 253
             $this->addError($attribute,
254 254
                 Yii::t('app',
255 255
                     'Invalid phone number "{0}"', [$phone_number]
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
         $query->andWhere($email_condition, [':email_address' => $email_address, ':email_address2' => '%\"' . $email_address . '\"%']);
284 284
 
285
-        if ($query->count() > 0) {
285
+        if ($query->count()>0) {
286 286
             $this->addError($attribute,
287 287
                 Yii::t('app',
288 288
                     'Invalid email address "{0}"', [$email_address]
@@ -389,14 +389,14 @@  discard block
 block discarded – undo
389 389
         return $query->createCommand()
390 390
             ->update(self::tableName(),
391 391
                 [$field=> $dateHelper->getDatetime6()],
392
-                ['in','token',$tokens]
392
+                ['in', 'token', $tokens]
393 393
             )->execute();
394 394
     }
395 395
 
396 396
     /**
397 397
      * @return array
398 398
      */
399
-    public function getParticipantData(){
399
+    public function getParticipantData() {
400 400
         return [];
401 401
     }
402 402
 
Please login to merge, or discard this patch.
src/Rejection.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         return array_merge([
46 46
             [['survey_id', 'respondent_id'], 'integer'],
47
-            [['email_address','time_rejected'], 'required'],
47
+            [['email_address', 'time_rejected'], 'required'],
48 48
             [['bounce'], 'string'],
49 49
             [['time_rejected'], 'safe'],
50 50
             [['email_address'], 'string', 'max' => 255],
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.