Completed
Branch BUG-10026-spco-sub-line-items (f195f1)
by
unknown
19:17
created
libraries/line_item_display/EE_SPCO_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -69,26 +69,26 @@  discard block
 block discarded – undo
69 69
 	 * @param array        $options
70 70
 	 * @return mixed
71 71
 	 */
72
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
72
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
73 73
 
74 74
 		$html = '';
75 75
 		// set some default options and merge with incoming
76 76
 		$default_options = array(
77
-			'show_desc' => true,  // 	true 		false
77
+			'show_desc' => true, // 	true 		false
78 78
 			'odd' => false
79 79
 		);
80
-		$options = array_merge( $default_options, (array)$options );
80
+		$options = array_merge($default_options, (array) $options);
81 81
 
82
-		switch( $line_item->type() ) {
82
+		switch ($line_item->type()) {
83 83
 
84 84
 			case EEM_Line_Item::type_line_item:
85 85
 				$this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
86
-				if ( $line_item->OBJ_type() == 'Ticket' ) {
86
+				if ($line_item->OBJ_type() == 'Ticket') {
87 87
 					// item row
88
-					$html .= $this->_ticket_row( $line_item, $options );
88
+					$html .= $this->_ticket_row($line_item, $options);
89 89
 				} else {
90 90
 					// item row
91
-					$html .= $this->_item_row( $line_item, $options );
91
+					$html .= $this->_item_row($line_item, $options);
92 92
 				}
93 93
 				if (
94 94
 					apply_filters(
@@ -97,76 +97,76 @@  discard block
 block discarded – undo
97 97
 					)
98 98
 				) {
99 99
 					// got any kids?
100
-					foreach ( $line_item->children() as $child_line_item ) {
101
-						$html .= $this->display_line_item( $child_line_item, $options );
100
+					foreach ($line_item->children() as $child_line_item) {
101
+						$html .= $this->display_line_item($child_line_item, $options);
102 102
 					}
103 103
 				}
104 104
 				break;
105 105
 
106 106
 			case EEM_Line_Item::type_sub_line_item:
107
-				$html .= $this->_sub_item_row( $line_item, $options );
107
+				$html .= $this->_sub_item_row($line_item, $options);
108 108
 				break;
109 109
 
110 110
 			case EEM_Line_Item::type_sub_total:
111 111
 				static $sub_total = 0;
112 112
 				$event_sub_total = 0;
113
-				$text = __( 'Sub-Total', 'event_espresso' );
114
-				if ( $line_item->OBJ_type() == 'Event' ) {
115
-					$options[ 'event_id' ] = $event_id = $line_item->OBJ_ID();
116
-					if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) {
117
-						$event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] );
118
-						if ( $event instanceof EE_Event ) {
119
-							if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) {
113
+				$text = __('Sub-Total', 'event_espresso');
114
+				if ($line_item->OBJ_type() == 'Event') {
115
+					$options['event_id'] = $event_id = $line_item->OBJ_ID();
116
+					if ( ! isset($this->_events[$options['event_id']])) {
117
+						$event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
118
+						if ($event instanceof EE_Event) {
119
+							if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) {
120 120
 								return '';
121 121
 							}
122 122
 						}
123
-						$this->_events[ $options[ 'event_id' ] ] = 0;
124
-						$html .= $this->_event_row( $line_item );
125
-						$text = __( 'Event Sub-Total', 'event_espresso' );
123
+						$this->_events[$options['event_id']] = 0;
124
+						$html .= $this->_event_row($line_item);
125
+						$text = __('Event Sub-Total', 'event_espresso');
126 126
 					}
127 127
 				}
128 128
 				$child_line_items = $line_item->children();
129 129
 				// loop thru children
130
-				foreach( $child_line_items as $child_line_item ) {
130
+				foreach ($child_line_items as $child_line_item) {
131 131
 					// recursively feed children back into this method
132
-					$html .= $this->display_line_item( $child_line_item, $options );
132
+					$html .= $this->display_line_item($child_line_item, $options);
133 133
 				}
134
-				$event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0;
134
+				$event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0;
135 135
 				$sub_total += $event_sub_total;
136 136
 				if (
137 137
 					(
138 138
 						// event subtotals
139 139
 						$line_item->code() != 'pre-tax-subtotal' &&
140
-						count( $child_line_items ) > 1
140
+						count($child_line_items) > 1
141 141
 					)
142 142
 					||
143 143
 					(
144 144
 						// pre-tax subtotals
145 145
 						$line_item->code() == 'pre-tax-subtotal' &&
146
-						count( $this->_events ) > 1
146
+						count($this->_events) > 1
147 147
 					)
148 148
 				) {
149 149
 					$options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total;
150
-					$html .= $this->_sub_total_row( $line_item, $text, $options );
150
+					$html .= $this->_sub_total_row($line_item, $text, $options);
151 151
 				}
152 152
 				break;
153 153
 
154 154
 			case EEM_Line_Item::type_tax:
155
-				if ( $this->_show_taxes ) {
156
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
155
+				if ($this->_show_taxes) {
156
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
157 157
 				}
158 158
 				break;
159 159
 
160 160
 			case EEM_Line_Item::type_tax_sub_total:
161
-				if ( $this->_show_taxes ) {
161
+				if ($this->_show_taxes) {
162 162
 					$child_line_items = $line_item->children();
163 163
 					// loop thru children
164
-					foreach( $child_line_items as $child_line_item ) {
164
+					foreach ($child_line_items as $child_line_item) {
165 165
 						// recursively feed children back into this method
166
-						$html .= $this->display_line_item( $child_line_item, $options );
166
+						$html .= $this->display_line_item($child_line_item, $options);
167 167
 					}
168
-					if ( count( $child_line_items ) > 1 ) {
169
-						$this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) );
168
+					if (count($child_line_items) > 1) {
169
+						$this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso'));
170 170
 					}
171 171
 				}
172 172
 				break;
@@ -175,25 +175,25 @@  discard block
 block discarded – undo
175 175
 				// get all child line items
176 176
 				$children = $line_item->children();
177 177
 				// loop thru all non-tax child line items
178
-				foreach( $children as $child_line_item ) {
179
-					if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) {
178
+				foreach ($children as $child_line_item) {
179
+					if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) {
180 180
 						// recursively feed children back into this method
181
-						$html .= $this->display_line_item( $child_line_item, $options );
181
+						$html .= $this->display_line_item($child_line_item, $options);
182 182
 					}
183 183
 				}
184 184
 
185 185
 				// now loop thru  tax child line items
186
-				foreach( $children as $child_line_item ) {
187
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) {
186
+				foreach ($children as $child_line_item) {
187
+					if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) {
188 188
 						// recursively feed children back into this method
189
-						$html .= $this->display_line_item( $child_line_item, $options );
189
+						$html .= $this->display_line_item($child_line_item, $options);
190 190
 					}
191 191
 				}
192 192
 				$html .= $this->_taxes_html;
193
-				$html .= $this->_total_row( $line_item, __('Total', 'event_espresso') );
193
+				$html .= $this->_total_row($line_item, __('Total', 'event_espresso'));
194 194
 
195 195
 
196
-				$html .= $this->_payments_and_amount_owing_rows( $line_item, $options );
196
+				$html .= $this->_payments_and_amount_owing_rows($line_item, $options);
197 197
 				break;
198 198
 
199 199
 		}
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	 * @param EE_Line_Item $line_item
209 209
 	 * @return mixed
210 210
 	 */
211
-	private function _event_row( EE_Line_Item $line_item ) {
211
+	private function _event_row(EE_Line_Item $line_item) {
212 212
 		// start of row
213
-		$html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' );
213
+		$html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd');
214 214
 		// event name td
215
-		$html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' );
215
+		$html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"');
216 216
 		// end of row
217 217
 		$html .= EEH_HTML::trx();
218 218
 		return $html;
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 	 * @param array        $options
228 228
 	 * @return mixed
229 229
 	 */
230
-	private function _ticket_row( EE_Line_Item $line_item, $options = array() ) {
230
+	private function _ticket_row(EE_Line_Item $line_item, $options = array()) {
231 231
 		// start of row
232 232
 		$row_class = $options['odd'] ? 'item odd' : 'item';
233
-		$html = EEH_HTML::tr( '', '', $row_class );
233
+		$html = EEH_HTML::tr('', '', $row_class);
234 234
 		// name && desc
235 235
 		$name_and_desc = apply_filters(
236 236
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
@@ -239,23 +239,23 @@  discard block
 block discarded – undo
239 239
 		);
240 240
 		$name_and_desc .= apply_filters(
241 241
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
242
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
242
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
243 243
 			$line_item,
244 244
 			$options
245 245
 		);
246 246
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
247 247
 		// name td
248
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l' );
248
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' );
249 249
 		// price td
250
-		$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
250
+		$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
251 251
 		// quantity td
252
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
252
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
253 253
 		$this->_total_items += $line_item->quantity();
254 254
 		// determine total for line item
255 255
 		$total = $line_item->total();
256
-		$this->_events[ $options[ 'event_id' ] ] += $total;
256
+		$this->_events[$options['event_id']] += $total;
257 257
 		// total td
258
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
258
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
259 259
 		// end of row
260 260
 		$html .= EEH_HTML::trx();
261 261
 		return $html;
@@ -270,41 +270,41 @@  discard block
 block discarded – undo
270 270
 	 * @param array        $options
271 271
 	 * @return mixed
272 272
 	 */
273
-	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
273
+	private function _item_row(EE_Line_Item $line_item, $options = array()) {
274 274
 		// start of row
275 275
 		$row_class = $options['odd'] ? 'item odd' : 'item';
276
-		$html = EEH_HTML::tr( '', '', $row_class );
277
-		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . ': ' : '';
276
+		$html = EEH_HTML::tr('', '', $row_class);
277
+		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n().': ' : '';
278 278
 		// name && desc
279 279
 		$name_and_desc = apply_filters(
280 280
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
281
-			 $obj_name . $line_item->name(),
281
+			 $obj_name.$line_item->name(),
282 282
 			$line_item
283 283
 		);
284 284
 		$name_and_desc .= apply_filters(
285 285
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
286
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
286
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
287 287
 			$line_item,
288 288
 			$options
289 289
 		);
290 290
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
291 291
 		// name td
292
-		$html .= EEH_HTML::td( $name_and_desc, '',  'item_l' );
292
+		$html .= EEH_HTML::td($name_and_desc, '', 'item_l');
293 293
 		// price td
294
-		if ( $line_item->is_percent() ) {
295
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' );
294
+		if ($line_item->is_percent()) {
295
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght');
296 296
 		} else {
297
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' );
297
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
298 298
 		}
299 299
 		// quantity td
300
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
300
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
301 301
 		//$total = $line_item->total() * $line_item->quantity();
302 302
 		$total = $line_item->total();
303
-		if( isset( $options[ 'event_id' ] ) && isset( $this->_events[ $options[ 'event_id' ] ] ) ) {
304
-			$this->_events[ $options[ 'event_id' ] ] += $total;
303
+		if (isset($options['event_id']) && isset($this->_events[$options['event_id']])) {
304
+			$this->_events[$options['event_id']] += $total;
305 305
 		}
306 306
 		// total td
307
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
307
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
308 308
 		// end of row
309 309
 		$html .= EEH_HTML::trx();
310 310
 		return $html;
@@ -319,19 +319,19 @@  discard block
 block discarded – undo
319 319
 	 * @param array        $options
320 320
 	 * @return mixed
321 321
 	 */
322
-	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
322
+	private function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
323 323
 		// start of row
324
-		$html = EEH_HTML::tr( '', '', 'item sub-item-row' );
324
+		$html = EEH_HTML::tr('', '', 'item sub-item-row');
325 325
 		// name && desc
326
-		$name_and_desc = EEH_HTML::span('', '', 'sub-item-row-bullet dashicons dashicons-arrow-right' ) . $line_item->name();
327
-		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '';
326
+		$name_and_desc = EEH_HTML::span('', '', 'sub-item-row-bullet dashicons dashicons-arrow-right').$line_item->name();
327
+		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : '';
328 328
 		// name td
329
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
329
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
330 330
 		// discount/surcharge td
331
-		if ( $line_item->is_percent() ) {
332
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '',  'item_c' );
331
+		if ($line_item->is_percent()) {
332
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c');
333 333
 		} else {
334
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
334
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
335 335
 		}
336 336
 		// no quantity td
337 337
 		$html .= EEH_HTML::td();
@@ -351,21 +351,21 @@  discard block
 block discarded – undo
351 351
 	 * @param array        $options
352 352
 	 * @return mixed
353 353
 	 */
354
-	private function _tax_row( EE_Line_Item $line_item, $options = array() ) {
354
+	private function _tax_row(EE_Line_Item $line_item, $options = array()) {
355 355
 		// start of row
356
-		$html = EEH_HTML::tr( '', 'item sub-item tax-total' );
356
+		$html = EEH_HTML::tr('', 'item sub-item tax-total');
357 357
 		// name && desc
358 358
 		$name_and_desc = $line_item->name();
359
-		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>';
360
-		$name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : '';
359
+		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>';
360
+		$name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : '';
361 361
 		// name td
362
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
362
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
363 363
 		// percent td
364
-		$html .= EEH_HTML::td( $line_item->percent() . '%', '',  ' jst-rght', '' );
364
+		$html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', '');
365 365
 		// empty td (price)
366
-		$html .= EEH_HTML::td( EEH_HTML::nbsp() );
366
+		$html .= EEH_HTML::td(EEH_HTML::nbsp());
367 367
 		// total td
368
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
368
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
369 369
 		// end of row
370 370
 		$html .= EEH_HTML::trx();
371 371
 		return $html;
@@ -380,17 +380,17 @@  discard block
 block discarded – undo
380 380
 	 * @param string $text
381 381
 	 * @return mixed
382 382
 	 */
383
-	private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) {
383
+	private function _total_tax_row(EE_Line_Item $line_item, $text = '') {
384 384
 		$html = '';
385
-		if ( $line_item->total() ) {
385
+		if ($line_item->total()) {
386 386
 			// start of row
387
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
387
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
388 388
 			// total td
389
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' );
389
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"');
390 390
 			// empty td (price)
391
-			$html .= EEH_HTML::td( EEH_HTML::nbsp() );
391
+			$html .= EEH_HTML::td(EEH_HTML::nbsp());
392 392
 			// total td
393
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' );
393
+			$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
394 394
 			// end of row
395 395
 			$html .= EEH_HTML::trx();
396 396
 		}
@@ -407,15 +407,15 @@  discard block
 block discarded – undo
407 407
 	 * @param array        $options
408 408
 	 * @return mixed
409 409
 	 */
410
-	private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
410
+	private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
411 411
 		$html = '';
412
-		if ( $line_item->total() ) {
412
+		if ($line_item->total()) {
413 413
 			// start of row
414
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
414
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
415 415
 			// total td
416
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' );
416
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
417 417
 			// total td
418
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' );
418
+			$html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght');
419 419
 			// end of row
420 420
 			$html .= EEH_HTML::trx();
421 421
 		}
@@ -432,13 +432,13 @@  discard block
 block discarded – undo
432 432
 	 * @param string       $text
433 433
 	 * @return mixed
434 434
 	 */
435
-	private function _total_row( EE_Line_Item $line_item, $text = '' ) {
435
+	private function _total_row(EE_Line_Item $line_item, $text = '') {
436 436
 		// start of row
437
-		$html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' );
437
+		$html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd');
438 438
 		// total td
439
-		$html .= EEH_HTML::td( $text, '',  'total_currency total jst-rght',  '',  ' colspan="3"' );
439
+		$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
440 440
 		// total td
441
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'total jst-rght' );
441
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
442 442
 		// end of row
443 443
 		$html .= EEH_HTML::trx();
444 444
 		return $html;
@@ -453,30 +453,30 @@  discard block
 block discarded – undo
453 453
 	 * @param array        $options
454 454
 	 * @return mixed
455 455
 	 */
456
-	private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) {
456
+	private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) {
457 457
 		$html = '';
458 458
 		$owing = $line_item->total();
459
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() );
460
-		if ( $transaction instanceof EE_Transaction ) {
459
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
460
+		if ($transaction instanceof EE_Transaction) {
461 461
 			$registration_payments = array();
462
-			$registrations = ! empty( $options['registrations'] )
463
-				? $options[ 'registrations' ]
462
+			$registrations = ! empty($options['registrations'])
463
+				? $options['registrations']
464 464
 				: $transaction->registrations();
465
-			foreach ( $registrations as $registration ) {
466
-				if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
465
+			foreach ($registrations as $registration) {
466
+				if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
467 467
 					$registration_payments = $registration_payments + $registration->registration_payments();
468 468
 				}
469 469
 			}
470
-			if ( ! empty( $registration_payments )) {
471
-				foreach ( $registration_payments as $registration_payment ) {
472
-					if ( $registration_payment instanceof EE_Registration_Payment ) {
470
+			if ( ! empty($registration_payments)) {
471
+				foreach ($registration_payments as $registration_payment) {
472
+					if ($registration_payment instanceof EE_Registration_Payment) {
473 473
 						$owing = $owing - $registration_payment->amount();
474 474
 						$payment = $registration_payment->payment();
475
-						if ( $payment instanceof EE_Payment ) {
475
+						if ($payment instanceof EE_Payment) {
476 476
 							$payment_desc = sprintf(
477
-								__( 'Payment%1$s Received: %2$s', 'event_espresso' ),
477
+								__('Payment%1$s Received: %2$s', 'event_espresso'),
478 478
 								$payment->txn_id_chq_nmbr() != ''
479
-									? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
479
+									? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> '
480 480
 									: '',
481 481
 								$payment->timestamp()
482 482
 							);
@@ -484,12 +484,12 @@  discard block
 block discarded – undo
484 484
 							$payment_desc = '';
485 485
 						}
486 486
 						// start of row
487
-						$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
487
+						$html .= EEH_HTML::tr('', '', 'total_tr odd');
488 488
 						// payment desc
489
-						$html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' );
489
+						$html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
490 490
 						// total td
491 491
 						$html .= EEH_HTML::td(
492
-							EEH_Template::format_currency( $registration_payment->amount(), false, false ),
492
+							EEH_Template::format_currency($registration_payment->amount(), false, false),
493 493
 							'',
494 494
 							'total jst-rght'
495 495
 						);
@@ -497,17 +497,17 @@  discard block
 block discarded – undo
497 497
 						$html .= EEH_HTML::trx();
498 498
 					}
499 499
 				}
500
-				if ( $line_item->total() ) {
500
+				if ($line_item->total()) {
501 501
 					// start of row
502
-					$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
502
+					$html .= EEH_HTML::tr('', '', 'total_tr odd');
503 503
 					// total td
504 504
 					$html .= EEH_HTML::td(
505 505
 						__('Amount Owing', 'event_espresso'),
506
-						'',  'total_currency total jst-rght',  '',  ' colspan="3"'
506
+						'', 'total_currency total jst-rght', '', ' colspan="3"'
507 507
 					);
508 508
 					// total td
509 509
 					$html .= EEH_HTML::td(
510
-						EEH_Template::format_currency( $owing, false, false ), '',  'total jst-rght'
510
+						EEH_Template::format_currency($owing, false, false), '', 'total jst-rght'
511 511
 					);
512 512
 					// end of row
513 513
 					$html .= EEH_HTML::trx();
Please login to merge, or discard this patch.