@@ -13,90 +13,90 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * Will hold an EE_Messages_Queue object |
|
18 | - * @type EE_Messages_Queue |
|
19 | - */ |
|
20 | - public $queue = array(); |
|
16 | + /** |
|
17 | + * Will hold an EE_Messages_Queue object |
|
18 | + * @type EE_Messages_Queue |
|
19 | + */ |
|
20 | + public $queue = array(); |
|
21 | 21 | |
22 | - /** |
|
23 | - * @param string $messenger_name The messenger being used to send the message |
|
24 | - * @param string $message_type_name The message type being used to grab variations etc. |
|
25 | - * @param EE_Messages_Queue $queue |
|
26 | - * @param string $custom_subject Used if a custom subject is desired for the generated aggregate EE_Message object |
|
27 | - */ |
|
28 | - public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '') |
|
29 | - { |
|
30 | - $this->queue = $queue; |
|
31 | - parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle); |
|
32 | - if ($this->valid()) { |
|
33 | - $this->_message->set_content($this->_get_content()); |
|
34 | - $this->_message->set_subject($this->_get_subject($custom_subject)); |
|
35 | - $this->_message->set_GRP_ID($this->getGroupIdFromMessageRepo()); |
|
36 | - } |
|
37 | - } |
|
22 | + /** |
|
23 | + * @param string $messenger_name The messenger being used to send the message |
|
24 | + * @param string $message_type_name The message type being used to grab variations etc. |
|
25 | + * @param EE_Messages_Queue $queue |
|
26 | + * @param string $custom_subject Used if a custom subject is desired for the generated aggregate EE_Message object |
|
27 | + */ |
|
28 | + public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '') |
|
29 | + { |
|
30 | + $this->queue = $queue; |
|
31 | + parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle); |
|
32 | + if ($this->valid()) { |
|
33 | + $this->_message->set_content($this->_get_content()); |
|
34 | + $this->_message->set_subject($this->_get_subject($custom_subject)); |
|
35 | + $this->_message->set_GRP_ID($this->getGroupIdFromMessageRepo()); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * Uses the EE_Messages_Queue currently set on this object to generate the content |
|
43 | - * for the single EE_Message aggregate object returned by get_EE_Message |
|
44 | - * @return string; |
|
45 | - */ |
|
46 | - protected function _get_content() |
|
47 | - { |
|
48 | - $content = ''; |
|
49 | - $this->queue->get_message_repository()->rewind(); |
|
50 | - while ($this->queue->get_message_repository()->valid()) { |
|
51 | - $content .= $this->queue->get_message_repository()->current()->content(); |
|
52 | - $this->queue->get_message_repository()->next(); |
|
53 | - } |
|
54 | - return $content; |
|
55 | - } |
|
41 | + /** |
|
42 | + * Uses the EE_Messages_Queue currently set on this object to generate the content |
|
43 | + * for the single EE_Message aggregate object returned by get_EE_Message |
|
44 | + * @return string; |
|
45 | + */ |
|
46 | + protected function _get_content() |
|
47 | + { |
|
48 | + $content = ''; |
|
49 | + $this->queue->get_message_repository()->rewind(); |
|
50 | + while ($this->queue->get_message_repository()->valid()) { |
|
51 | + $content .= $this->queue->get_message_repository()->current()->content(); |
|
52 | + $this->queue->get_message_repository()->next(); |
|
53 | + } |
|
54 | + return $content; |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * Return a subject string to use for `MSG_Subject` in the aggregate EE_Message object. |
|
60 | - * @param string $custom_subject |
|
61 | - * |
|
62 | - * @return string |
|
63 | - */ |
|
64 | - protected function _get_subject($custom_subject = '') |
|
65 | - { |
|
66 | - if (! empty($custom_subject)) { |
|
67 | - return $custom_subject; |
|
68 | - } |
|
69 | - $this->queue->get_message_repository()->rewind(); |
|
70 | - $count_of_items = $this->queue->get_message_repository()->count(); |
|
58 | + /** |
|
59 | + * Return a subject string to use for `MSG_Subject` in the aggregate EE_Message object. |
|
60 | + * @param string $custom_subject |
|
61 | + * |
|
62 | + * @return string |
|
63 | + */ |
|
64 | + protected function _get_subject($custom_subject = '') |
|
65 | + { |
|
66 | + if (! empty($custom_subject)) { |
|
67 | + return $custom_subject; |
|
68 | + } |
|
69 | + $this->queue->get_message_repository()->rewind(); |
|
70 | + $count_of_items = $this->queue->get_message_repository()->count(); |
|
71 | 71 | |
72 | - // if $count of items in queue == 1, then let's just return the subject for that item. |
|
73 | - if ($count_of_items === 1) { |
|
74 | - return $this->queue->get_message_repository()->current()->subject(); |
|
75 | - } |
|
76 | - // phpcs:disable WordPress.WP.I18n.MissingSingularPlaceholder |
|
77 | - return sprintf( |
|
78 | - _n( |
|
79 | - 'Showing Aggregate output for 1 result', |
|
80 | - 'Showing Aggregate output for %d items', |
|
81 | - $count_of_items, |
|
82 | - 'event_espresso' |
|
83 | - ), |
|
84 | - $count_of_items |
|
85 | - ); |
|
86 | - // phpcs:enable |
|
87 | - } |
|
72 | + // if $count of items in queue == 1, then let's just return the subject for that item. |
|
73 | + if ($count_of_items === 1) { |
|
74 | + return $this->queue->get_message_repository()->current()->subject(); |
|
75 | + } |
|
76 | + // phpcs:disable WordPress.WP.I18n.MissingSingularPlaceholder |
|
77 | + return sprintf( |
|
78 | + _n( |
|
79 | + 'Showing Aggregate output for 1 result', |
|
80 | + 'Showing Aggregate output for %d items', |
|
81 | + $count_of_items, |
|
82 | + 'event_espresso' |
|
83 | + ), |
|
84 | + $count_of_items |
|
85 | + ); |
|
86 | + // phpcs:enable |
|
87 | + } |
|
88 | 88 | |
89 | 89 | |
90 | - /** |
|
91 | - * Uses the EE_Messages_Queue currently set on this object to set the GRP_ID |
|
92 | - * for the single EE_Message aggregate object returned by get_EE_Message |
|
93 | - * @return int; |
|
94 | - */ |
|
95 | - protected function getGroupIdFromMessageRepo() |
|
96 | - { |
|
97 | - $this->queue->get_message_repository()->rewind(); |
|
98 | - if ($this->queue->get_message_repository()->valid()) { |
|
99 | - return $this->queue->get_message_repository()->current()->GRP_ID(); |
|
100 | - } |
|
101 | - } |
|
90 | + /** |
|
91 | + * Uses the EE_Messages_Queue currently set on this object to set the GRP_ID |
|
92 | + * for the single EE_Message aggregate object returned by get_EE_Message |
|
93 | + * @return int; |
|
94 | + */ |
|
95 | + protected function getGroupIdFromMessageRepo() |
|
96 | + { |
|
97 | + $this->queue->get_message_repository()->rewind(); |
|
98 | + if ($this->queue->get_message_repository()->valid()) { |
|
99 | + return $this->queue->get_message_repository()->current()->GRP_ID(); |
|
100 | + } |
|
101 | + } |
|
102 | 102 | } |