Completed
Branch BUG-10127-fix-messages-data-ha... (baa16c)
by
unknown
81:31 queued 65:21
created
messages/data_class/EE_Messages_Registrations_incoming_data.class.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3 3
 
4 4
 /**
5 5
  * This prepares data for message types that send messages for multiple registrations (that could span multiple
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	 * @throws EE_Error
21 21
 	 * @access protected
22 22
 	 */
23
-	public function __construct( $data = array() ) {
23
+	public function __construct($data = array()) {
24 24
 
25 25
 		//validate that the first element in the array is an EE_Registration object.
26
-		if ( ! reset( $data ) instanceof EE_Registration ) {
27
-			throw new EE_Error( __( 'The EE_Message_Registrations_incoming_data class expects an array of EE_Registration objects.', 'event_espresso' ) );
26
+		if ( ! reset($data) instanceof EE_Registration) {
27
+			throw new EE_Error(__('The EE_Message_Registrations_incoming_data class expects an array of EE_Registration objects.', 'event_espresso'));
28 28
 		}
29
-		parent::__construct( $data );
29
+		parent::__construct($data);
30 30
 	}
31 31
 
32 32
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return EE_Registration[]   The data being prepared for the db
60 60
 	 */
61
-	static public function convert_data_for_persistent_storage( $registrations ) {
61
+	static public function convert_data_for_persistent_storage($registrations) {
62 62
 		if (
63
-			! is_array( $registrations )
64
-			|| ! reset( $registrations ) instanceof EE_Registration
63
+			! is_array($registrations)
64
+			|| ! reset($registrations) instanceof EE_Registration
65 65
 		) {
66 66
 			return array();
67 67
 		}
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 
71 71
 		$registration_ids = array_filter(
72 72
 			array_map(
73
-				function( $registration ) {
74
-					if ( $registration instanceof EE_Registration ) {
73
+				function($registration) {
74
+					if ($registration instanceof EE_Registration) {
75 75
 						return $registration->ID();
76 76
 					}
77 77
 				},
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return EE_Registration[]
97 97
 	 */
98
-	static public function convert_data_from_persistent_storage( $data ) {
98
+	static public function convert_data_from_persistent_storage($data) {
99 99
 		//since this was added later, we need to account of possible back compat issues where data already queued for generation
100 100
 		//is in the old format, which is an array of EE_Registration objects.  So if that's the case, then let's just return them
101 101
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/10127
102
-		if ( is_array( $data ) && reset( $data ) instanceof EE_Registration ) {
102
+		if (is_array($data) && reset($data) instanceof EE_Registration) {
103 103
 			return $data;
104 104
 		}
105 105
 
106
-		$registrations = is_array( $data )
107
-				? EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $data ) ) ) )
106
+		$registrations = is_array($data)
107
+				? EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $data))))
108 108
 				: array();
109 109
 		return $registrations;
110 110
 	}
Please login to merge, or discard this patch.