@@ -25,29 +25,41 @@ public function __construct()
25
25
public function generateMessage ($ toQuantity , $ ccQuantity = 0 , $ bccQuantity = 0 )
26
26
{
27
27
$ toQuantity = (int )$ toQuantity ;
28
- if ($ toQuantity < 1 ) $ toQuantity = 1 ;
29
- if ($ toQuantity > 20 ) $ toQuantity = 20 ;
28
+ if ($ toQuantity < 1 ) {
29
+ $ toQuantity = 1 ;
30
+ }
31
+ if ($ toQuantity > 20 ) {
32
+ $ toQuantity = 20 ;
33
+ }
30
34
$ ccQuantity = (int )$ ccQuantity ;
31
- if ($ ccQuantity < 0 ) $ ccQuantity = 0 ;
32
- if ($ ccQuantity > 20 ) $ ccQuantity = 20 ;
35
+ if ($ ccQuantity < 0 ) {
36
+ $ ccQuantity = 0 ;
37
+ }
38
+ if ($ ccQuantity > 20 ) {
39
+ $ ccQuantity = 20 ;
40
+ }
33
41
$ bccQuantity = (int )$ bccQuantity ;
34
- if ($ bccQuantity < 0 ) $ bccQuantity = 0 ;
35
- if ($ bccQuantity > 20 ) $ bccQuantity = 20 ;
42
+ if ($ bccQuantity < 0 ) {
43
+ $ bccQuantity = 0 ;
44
+ }
45
+ if ($ bccQuantity > 20 ) {
46
+ $ bccQuantity = 20 ;
47
+ }
36
48
$ all = $ toQuantity + $ ccQuantity + $ bccQuantity ;
37
49
$ recipients = $ this ->generateRecipients ($ all );
38
50
39
51
$ subject = $ this ->faker ->text (50 );
40
52
$ text = $ this ->faker ->randomHtml ();
41
53
$ message = new Message ($ subject , $ text , true );
42
- for ($ n= 1 ; $ n<= $ toQuantity ; $ n ++) {
54
+ for ($ n = 1 ; $ n <= $ toQuantity ; $ n ++) {
43
55
$ recipient = array_shift ($ recipients );
44
56
$ message ->addTo ($ recipient ["email " ], $ recipient ["name " ]);
45
57
}
46
- for ($ n= 1 ; $ n<= $ ccQuantity ; $ n ++) {
58
+ for ($ n = 1 ; $ n <= $ ccQuantity ; $ n ++) {
47
59
$ recipient = array_shift ($ recipients );
48
60
$ message ->addCc ($ recipient ["email " ], $ recipient ["name " ]);
49
61
}
50
- for ($ n= 1 ; $ n<= $ bccQuantity ; $ n ++) {
62
+ for ($ n = 1 ; $ n <= $ bccQuantity ; $ n ++) {
51
63
$ recipient = array_shift ($ recipients );
52
64
$ message ->addBcc ($ recipient ["email " ], $ recipient ["name " ]);
53
65
}
@@ -58,8 +70,12 @@ public function generateMessage($toQuantity, $ccQuantity = 0, $bccQuantity = 0)
58
70
public function generateRecipients ($ quantity )
59
71
{
60
72
$ quantity = (int )$ quantity ;
61
- if ($ quantity < 1 ) $ quantity = 1 ;
62
- if ($ quantity > 100 ) $ quantity = 100 ;
73
+ if ($ quantity < 1 ) {
74
+ $ quantity = 1 ;
75
+ }
76
+ if ($ quantity > 100 ) {
77
+ $ quantity = 100 ;
78
+ }
63
79
$ recipients = array ();
64
80
do {
65
81
$ email = $ this ->faker ->email ;
@@ -72,4 +88,4 @@ public function generateRecipients($quantity)
72
88
} while (count ($ recipients ) < $ quantity );
73
89
return $ recipients ;
74
90
}
75
- }
91
+ }
0 commit comments