Completed
Branch BUG/11220/admin-page-routes (c5a0e9)
by
unknown
57:44 queued 46:14
created
caffeinated/payment_methods/Aim/EE_PMT_Aim.pm.php 2 patches
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION')){
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5 5
 }
6 6
 /**
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @subpackage
12 12
  * @author				Mike Nelson
13 13
  */
14
-class EE_PMT_Aim extends EE_PMT_Base{
14
+class EE_PMT_Aim extends EE_PMT_Base {
15 15
 
16 16
 
17 17
 	/**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		require_once($this->file_folder().'EEG_Aim.gateway.php');
35 35
 		$this->_gateway = new EEG_Aim();
36 36
 		$this->_pretty_name = __("Authorize.net AIM", 'event_espresso');
37
-		$this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' );
37
+		$this->_default_description = __('Please provide the following billing information.', 'event_espresso');
38 38
 		$this->_requires_https = true;
39 39
 	}
40 40
 
@@ -47,61 +47,61 @@  discard block
 block discarded – undo
47 47
 	 * @return EE_Billing_Info_Form
48 48
 	 * @throws \EE_Error
49 49
 	 */
50
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
51
-		$billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array(
50
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
51
+		$billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array(
52 52
 			'name'=>'AIM_Form',
53 53
 			'subsections'=>array(
54 54
 				'credit_card'=>new EE_Credit_Card_Input(array(
55 55
 					'required'=>true,
56
-					'html_label_text' => __( 'Card Number', 'event_espresso' )
56
+					'html_label_text' => __('Card Number', 'event_espresso')
57 57
 				)),
58 58
 				'exp_month'=>new EE_Credit_Card_Month_Input(true, array(
59 59
 					'required'=>true,
60
-					'html_label_text' => __( 'Expiry Month', 'event_espresso' )
60
+					'html_label_text' => __('Expiry Month', 'event_espresso')
61 61
 				)),
62
-				'exp_year'=>new EE_Credit_Card_Year_Input( array( 
62
+				'exp_year'=>new EE_Credit_Card_Year_Input(array( 
63 63
 					'required'=>true,
64
-					'html_label_text' => __( 'Expiry Year', 'event_espresso' ) 
64
+					'html_label_text' => __('Expiry Year', 'event_espresso') 
65 65
 				)),
66
-				'cvv'=>new EE_CVV_Input( array(
66
+				'cvv'=>new EE_CVV_Input(array(
67 67
 					'required'=>true,
68
-					'html_label_text' => __( 'CVV', 'event_espresso' ) ) ),
68
+					'html_label_text' => __('CVV', 'event_espresso') )),
69 69
 			)
70 70
 		));
71
-		$billing_form->add_subsections( array(
72
-			'company' => new EE_Text_Input( array(
71
+		$billing_form->add_subsections(array(
72
+			'company' => new EE_Text_Input(array(
73 73
 				'html_label_text' => __('Company', 'event_espresso')
74 74
 			))
75
-		), 'email', false );
75
+		), 'email', false);
76 76
 		$billing_form->add_subsections( 
77 77
 				array(
78
-					'fax' => new EE_Text_Input( array(
78
+					'fax' => new EE_Text_Input(array(
79 79
 						'html_label_text' => __('Fax', 'event_espresso')
80 80
 					))
81 81
 				), 
82 82
 				'phone', 
83 83
 				false );
84 84
 		$settings_form = $this->settings_form();
85
-		if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) {
86
-				$billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() );
85
+		if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) {
86
+				$billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value());
87 87
 		}
88
-		if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) {
89
-			$required_inputs = $settings_form->get_input( 'required_billing_inputs' )->normalized_value();
88
+		if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) {
89
+			$required_inputs = $settings_form->get_input('required_billing_inputs')->normalized_value();
90 90
 			//only change the requirement of inputs which are allowed to be changed
91 91
 			/** @var EE_Form_Input_Base[] $inputs_to_evaluate */
92 92
 			$inputs_to_evaluate = array_intersect_key( 
93 93
 				$billing_form->inputs(), 
94 94
 				$this->billing_input_names()
95 95
 			);
96
-			foreach( $inputs_to_evaluate as $input_name => $input ) {
97
-				if( in_array( $input_name, $required_inputs ) ) {
98
-					$input->set_required( true );
96
+			foreach ($inputs_to_evaluate as $input_name => $input) {
97
+				if (in_array($input_name, $required_inputs)) {
98
+					$input->set_required(true);
99 99
 				} else {
100
-					$input->set_required( false );
100
+					$input->set_required(false);
101 101
 				}
102 102
 			}
103 103
 		}
104
-		return $this->apply_billing_form_debug_settings( $billing_form );
104
+		return $this->apply_billing_form_debug_settings($billing_form);
105 105
 	}
106 106
 
107 107
 
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
 	 * @return \EE_Billing_Info_Form
115 115
 	 * @throws \EE_Error
116 116
 	 */
117
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
117
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
118 118
 		if (
119 119
 			$this->_pm_instance->debug_mode() 
120
-			|| $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE )
120
+			|| $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE)
121 121
 		) {
122
-			$billing_form->get_input( 'credit_card' )->set_default( '4007000000027' );
123
-			$billing_form->get_input( 'exp_year' )->set_default( '2020' );
124
-			if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) {
125
-				$billing_form->get_input( 'cvv' )->set_default( '123' );
122
+			$billing_form->get_input('credit_card')->set_default('4007000000027');
123
+			$billing_form->get_input('exp_year')->set_default('2020');
124
+			if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) {
125
+				$billing_form->get_input('cvv')->set_default('123');
126 126
 			}
127 127
 			$billing_form->add_subsections(
128
-				array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ),
128
+				array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()),
129 129
 				'credit_card'
130 130
 			);
131 131
 			$billing_form->add_subsections(
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 				'extra_meta_inputs'=>array(
154 154
 					'login_id'=>new EE_Text_Input(
155 155
 						array(
156
-							'html_label_text'=>  sprintf( __("Authorize.net API Login ID %s", "event_espresso"),  $this->get_help_tab_link() ),
156
+							'html_label_text'=>  sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()),
157 157
 							'required' => true )
158 158
 					),
159 159
 					'transaction_key'=>new EE_Text_Input(
160 160
 						array(
161
-							'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ),
161
+							'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()),
162 162
 							'required' => true )
163 163
 					),
164 164
 					'test_transactions'=>new EE_Yes_No_Input(
165 165
 						array(
166
-							'html_label_text'=>  sprintf( __("Send test transactions? %s", 'event_espresso'),  $this->get_help_tab_link() ),
166
+							'html_label_text'=>  sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()),
167 167
 							'html_help_text'=>  __("Send test transactions, even to live server", 'event_espresso'),
168 168
 							'default' => false,
169 169
 							'required' => true
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 					'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( 
173 173
 							$billing_input_names,
174 174
 					array( 
175
-						'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'),  $this->get_help_tab_link() ),
175
+						'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()),
176 176
 						'default' => array(
177 177
 							'company',
178 178
 							'fax',
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 					'required_billing_inputs' => new EE_Checkbox_Multi_Input( 
182 182
 						$billing_input_names,
183 183
 						array(
184
-							'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'),  $this->get_help_tab_link() ),
184
+							'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()),
185 185
 							'default' => array_diff(
186
-										array_keys( $billing_input_names ),
187
-										array( 'address2', 'phone', 'company', 'fax' )
186
+										array_keys($billing_input_names),
187
+										array('address2', 'phone', 'company', 'fax')
188 188
 							),
189 189
 							'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso')
190 190
 						)
@@ -193,14 +193,14 @@  discard block
 block discarded – undo
193 193
 						apply_filters(
194 194
 							'FHEE__EE_PMT_Aim__generate_new_settings_form__server_select_input__options',
195 195
 							array(
196
-								'akamai' => __( 'Authorize.net/Akamai (default)', 'event_espresso' ),
197
-								'authorize.net' => __( 'Authorize.net (deprecated)', 'event_espresso' ),
196
+								'akamai' => __('Authorize.net/Akamai (default)', 'event_espresso'),
197
+								'authorize.net' => __('Authorize.net (deprecated)', 'event_espresso'),
198 198
 							),
199 199
 							$this
200 200
 						),
201 201
 						array(
202
-							'html_label_text' => __( 'Server', 'event_espresso' ),
203
-							'html_help_text' => __( 'The Gateway Server where payment requests will be sent', 'event_espresso' )
202
+							'html_label_text' => __('Server', 'event_espresso'),
203
+							'html_help_text' => __('The Gateway Server where payment requests will be sent', 'event_espresso')
204 204
 						)
205 205
 					)
206 206
 						
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function billing_input_names() {
218 218
 		return array(
219
-			'first_name' => __( 'First Name', 'event_espresso' ),
219
+			'first_name' => __('First Name', 'event_espresso'),
220 220
 			'last_name' => __('Last Name', 'event_espresso'),
221
-			'email' => __( 'Email', 'event_espresso' ),
222
-			'company' => __( 'Company', 'event_espresso' ),
221
+			'email' => __('Email', 'event_espresso'),
222
+			'company' => __('Company', 'event_espresso'),
223 223
 			'address' => __('Address', 'event_espresso'),
224 224
 			'address2' => __('Address2', 'event_espresso'),
225 225
 			'city' => __('City', 'event_espresso'),
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			'country' => __('Country', 'event_espresso'),
228 228
 			'zip' =>  __('Zip', 'event_espresso'),
229 229
 			'phone' => __('Phone', 'event_espresso'),
230
-			'fax' => __( 'Fax', 'event_espresso' ),
230
+			'fax' => __('Fax', 'event_espresso'),
231 231
 			'cvv' => __('CVV', 'event_espresso')
232 232
 		);
233 233
 	}
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	 * @param EE_Billing_Info_Form $billing_form
240 240
 	 * @return array
241 241
 	 */
242
-	protected function _get_billing_values_from_form( $billing_form ){
242
+	protected function _get_billing_values_from_form($billing_form) {
243 243
 		$all_billing_values_empty = array();
244
-		foreach( array_keys( $this->billing_input_names() ) as $input_name ) {
245
-			$all_billing_values_empty[ $input_name ] = '';
244
+		foreach (array_keys($this->billing_input_names()) as $input_name) {
245
+			$all_billing_values_empty[$input_name] = '';
246 246
 		}
247 247
 		return array_merge(
248 248
 				$all_billing_values_empty,
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 * @see EE_PMT_Base::help_tabs_config()
258 258
 	 * @return array
259 259
 	 */
260
-	public function help_tabs_config(){
260
+	public function help_tabs_config() {
261 261
 		return array(
262 262
 			$this->get_help_tab_name() => array(
263 263
 				'title' => __('Authorize.net AIM Settings', 'event_espresso'),
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	public function __construct($pm_instance = NULL) {
23 23
 		$this->_setup_properties();
24 24
 		parent::__construct($pm_instance);
25
-        $this->_gateway->set_unsupported_character_remover(new \EventEspresso\core\services\formatters\Windows1252());
25
+		$this->_gateway->set_unsupported_character_remover(new \EventEspresso\core\services\formatters\Windows1252());
26 26
 	}
27 27
 	
28 28
 	/**
Please login to merge, or discard this patch.
core/services/progress_steps/ProgressStepManager.php 2 patches
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 use EventEspresso\core\services\collections\CollectionInterface;
11 11
 use EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface;
12 12
 
13
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
14
-	exit( 'No direct script access allowed' );
13
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
14
+	exit('No direct script access allowed');
15 15
 }
16 16
 
17 17
 
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 		CollectionInterface $collection = null,
79 79
 		EE_Request $request = null
80 80
 	) {
81
-		$this->setDisplayStrategy( $display_strategy_name );
82
-		$this->setDefaultStep( $default_step );
83
-		$this->setFormStepUrlKey( $form_step_url_key );
84
-		if ( ! $collection instanceof CollectionInterface ) {
85
-			$collection = new Collection( '\EventEspresso\core\services\progress_steps\ProgressStepInterface' );
81
+		$this->setDisplayStrategy($display_strategy_name);
82
+		$this->setDefaultStep($default_step);
83
+		$this->setFormStepUrlKey($form_step_url_key);
84
+		if ( ! $collection instanceof CollectionInterface) {
85
+			$collection = new Collection('\EventEspresso\core\services\progress_steps\ProgressStepInterface');
86 86
 		}
87 87
 		$this->collection = $collection;
88
-		if ( ! $request instanceof EE_Request ) {
89
-			$request = \EE_Registry::instance()->load_core( 'Request' );
88
+		if ( ! $request instanceof EE_Request) {
89
+			$request = \EE_Registry::instance()->load_core('Request');
90 90
 		}
91 91
 		$this->request = $request;
92 92
 	}
@@ -98,28 +98,28 @@  discard block
 block discarded – undo
98 98
 	 * @throws InvalidDataTypeException
99 99
 	 * @throws InvalidClassException
100 100
 	 */
101
-	protected function setDisplayStrategy( $display_strategy_name = 'number_bubbles' ) {
102
-		if ( ! is_string( $display_strategy_name ) ) {
103
-			throw new InvalidDataTypeException( '$display_strategy_name', $display_strategy_name, 'string' );
101
+	protected function setDisplayStrategy($display_strategy_name = 'number_bubbles') {
102
+		if ( ! is_string($display_strategy_name)) {
103
+			throw new InvalidDataTypeException('$display_strategy_name', $display_strategy_name, 'string');
104 104
 		}
105 105
 		// build up FQCN from incoming display strategy folder name
106 106
 		$display_strategy_class = 'EventEspresso\core\services\progress_steps\display_strategies\\';
107
-		$display_strategy_class .= $display_strategy_name . '\\';
108
-		$display_strategy_class .= str_replace( ' ', '', ucwords( str_replace( '_', ' ', $display_strategy_name ) ) );
107
+		$display_strategy_class .= $display_strategy_name.'\\';
108
+		$display_strategy_class .= str_replace(' ', '', ucwords(str_replace('_', ' ', $display_strategy_name)));
109 109
 		$display_strategy_class .= 'ProgressStepsDisplay';
110 110
 		$display_strategy_class = apply_filters(
111 111
 			'FHEE__ProgressStepManager__setDisplayStrategy__display_strategy_class',
112 112
 			$display_strategy_class
113 113
 		);
114
-		if ( ! class_exists( $display_strategy_class ) ) {
115
-			throw new InvalidClassException( $display_strategy_class );
114
+		if ( ! class_exists($display_strategy_class)) {
115
+			throw new InvalidClassException($display_strategy_class);
116 116
 		}
117 117
 		$display_strategy = new $display_strategy_class();
118
-		if ( ! $display_strategy instanceof ProgressStepsDisplayInterface ) {
118
+		if ( ! $display_strategy instanceof ProgressStepsDisplayInterface) {
119 119
 			throw new InvalidClassException(
120 120
 				$display_strategy_class,
121 121
 				sprintf(
122
-					__( 'The "%1$s" Class needs to be an implementation of the "%1$s" Interface.', 'event_espresso' ),
122
+					__('The "%1$s" Class needs to be an implementation of the "%1$s" Interface.', 'event_espresso'),
123 123
 					$display_strategy_class,
124 124
 					'\EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface'
125 125
 				)
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 	 * @param string $default_step
135 135
 	 * @throws InvalidDataTypeException
136 136
 	 */
137
-	public function setDefaultStep( $default_step ) {
138
-		if ( ! is_string( $default_step ) ) {
139
-			throw new InvalidDataTypeException( '$default_step', $default_step, 'string' );
137
+	public function setDefaultStep($default_step) {
138
+		if ( ! is_string($default_step)) {
139
+			throw new InvalidDataTypeException('$default_step', $default_step, 'string');
140 140
 		}
141 141
 		$this->default_step = $default_step;
142 142
 	}
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 	 * @param string $form_step_url_key
148 148
 	 * @throws InvalidDataTypeException
149 149
 	 */
150
-	public function setFormStepUrlKey( $form_step_url_key = 'ee-form-step' ) {
151
-		if ( ! is_string( $form_step_url_key ) ) {
152
-			throw new InvalidDataTypeException( '$form_step_key', $form_step_url_key, 'string' );
150
+	public function setFormStepUrlKey($form_step_url_key = 'ee-form-step') {
151
+		if ( ! is_string($form_step_url_key)) {
152
+			throw new InvalidDataTypeException('$form_step_key', $form_step_url_key, 'string');
153 153
 		}
154
-		$this->form_step_url_key = ! empty( $form_step_url_key ) ? $form_step_url_key : 'ee-form-step';
154
+		$this->form_step_url_key = ! empty($form_step_url_key) ? $form_step_url_key : 'ee-form-step';
155 155
 	}
156 156
 
157 157
 
@@ -160,26 +160,26 @@  discard block
 block discarded – undo
160 160
 	 * @param string $step
161 161
 	 * @throws InvalidIdentifierException
162 162
 	 */
163
-	public function setCurrentStep( $step = '' ) {
163
+	public function setCurrentStep($step = '') {
164 164
 		// use incoming value if it's set, otherwise use request param if it's set, otherwise use default
165
-		$step = ! empty( $step )
165
+		$step = ! empty($step)
166 166
 			? $step
167
-			: $this->request->get( $this->form_step_url_key, $this->default_step );
167
+			: $this->request->get($this->form_step_url_key, $this->default_step);
168 168
 		// grab the step previously known as current, in case we need to revert
169 169
 		$current_current_step = $this->collection->current();
170 170
 		// verify that requested step exists
171
-		if ( ! $this->collection->has( $step ) ) {
172
-			throw new InvalidIdentifierException( $step, $this->default_step );
171
+		if ( ! $this->collection->has($step)) {
172
+			throw new InvalidIdentifierException($step, $this->default_step);
173 173
 		}
174
-		if ( $this->collection->setCurrent( $step ) ) {
174
+		if ($this->collection->setCurrent($step)) {
175 175
 			// if the old boss is the same as the new boss, then nothing changes
176
-			if ( $this->collection->current() !== $current_current_step ) {
177
-				$current_current_step->setIsCurrent( false );
176
+			if ($this->collection->current() !== $current_current_step) {
177
+				$current_current_step->setIsCurrent(false);
178 178
 			}
179 179
 			$this->collection->current()->setIsCurrent();
180 180
 		} else {
181
-			$this->collection->setCurrent( $current_current_step->id() );
182
-			$current_current_step->setIsCurrent( true );
181
+			$this->collection->setCurrent($current_current_step->id());
182
+			$current_current_step->setIsCurrent(true);
183 183
 		}
184 184
 	}
185 185
 
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 	public function setPreviousStepsCompleted() {
192 192
 		$current_current_step = $this->collection->current();
193 193
 		$this->collection->rewind();
194
-		while ( $this->collection->valid() ) {
195
-			if ( $this->collection->current() === $current_current_step ) {
194
+		while ($this->collection->valid()) {
195
+			if ($this->collection->current() === $current_current_step) {
196 196
 				break;
197 197
 			}
198 198
 			$this->setCurrentStepCompleted();
199 199
 			$this->collection->next();
200 200
 		}
201
-		$this->collection->setCurrentUsingObject( $current_current_step );
201
+		$this->collection->setCurrentUsingObject($current_current_step);
202 202
 		return false;
203 203
 	}
204 204
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	public function displaySteps() {
240 240
 		return \EEH_Template::display_template(
241 241
 			$this->display_strategy->getTemplate(),
242
-			array( 'progress_steps' => $this->collection ),
242
+			array('progress_steps' => $this->collection),
243 243
 			true
244 244
 		);
245 245
 	}
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @param bool $completed
251 251
 	 * @return \EventEspresso\core\services\progress_steps\ProgressStepInterface
252 252
 	 */
253
-	public function setCurrentStepCompleted( $completed = true ) {
254
-		return $this->collection->current()->setIsCompleted( $completed );
253
+	public function setCurrentStepCompleted($completed = true) {
254
+		return $this->collection->current()->setIsCompleted($completed);
255 255
 	}
256 256
 
257 257
 
Please login to merge, or discard this patch.
Unused Use Statements   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
 namespace EventEspresso\core\services\progress_steps;
3 3
 
4 4
 use EE_Request;
5
-use  EventEspresso\core\exceptions\InvalidClassException;
6
-use  EventEspresso\core\exceptions\InvalidDataTypeException;
7
-use  EventEspresso\core\exceptions\InvalidIdentifierException;
8
-use  EventEspresso\core\exceptions\InvalidInterfaceException;
5
+use EventEspresso\core\exceptions\InvalidClassException;
6
+use EventEspresso\core\exceptions\InvalidDataTypeException;
7
+use EventEspresso\core\exceptions\InvalidIdentifierException;
8
+use EventEspresso\core\exceptions\InvalidInterfaceException;
9 9
 use EventEspresso\core\services\collections\Collection;
10 10
 use EventEspresso\core\services\collections\CollectionInterface;
11 11
 use EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface;
Please login to merge, or discard this patch.
display_strategies/number_bubbles/NumberBubblesProgressStepsDisplay.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 use EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface;
5 5
 
6
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-	exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		// core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css
30 30
 		wp_enqueue_style(
31 31
 			'ee_progress_steps_display_number_bubbles',
32
-			plugin_dir_url( __FILE__ ) . 'number_bubbles.css'
32
+			plugin_dir_url(__FILE__).'number_bubbles.css'
33 33
 		);
34 34
 	}
35 35
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function getTemplate() {
44 44
 		// return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php';
45
-		return __DIR__ . DS .'number_bubbles.template.php';
45
+		return __DIR__.DS.'number_bubbles.template.php';
46 46
 	}
47 47
 
48 48
 }
Please login to merge, or discard this patch.
core/services/collections/Collection.php 4 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\collections;
3 3
 
4
-use  EventEspresso\core\exceptions\InvalidEntityException;
5
-use  EventEspresso\core\exceptions\InvalidInterfaceException;
4
+use EventEspresso\core\exceptions\InvalidEntityException;
5
+use EventEspresso\core\exceptions\InvalidInterfaceException;
6 6
 use LimitIterator;
7 7
 
8 8
 if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 use  EventEspresso\core\exceptions\InvalidInterfaceException;
6 6
 use LimitIterator;
7 7
 
8
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
9
-	exit( 'No direct script access allowed' );
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10 10
 }
11 11
 /**
12 12
  * Class Collection
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	  * @param string $collection_interface
37 37
 	  * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
38 38
 	  */
39
-	 public function __construct( $collection_interface ) {
40
-		 $this->setCollectionInterface( $collection_interface );
39
+	 public function __construct($collection_interface) {
40
+		 $this->setCollectionInterface($collection_interface);
41 41
 	 }
42 42
 
43 43
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	  * @param  string $collection_interface
50 50
 	  * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
51 51
 	  */
52
-	 protected function setCollectionInterface( $collection_interface ) {
53
-		 if ( ! ( interface_exists( $collection_interface ) || class_exists( $collection_interface ) ) ) {
54
-			 throw new InvalidInterfaceException( $collection_interface );
52
+	 protected function setCollectionInterface($collection_interface) {
53
+		 if ( ! (interface_exists($collection_interface) || class_exists($collection_interface))) {
54
+			 throw new InvalidInterfaceException($collection_interface);
55 55
 		 }
56 56
 		 $this->collection_interface = $collection_interface;
57 57
 	 }
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	  * @return bool
71 71
 	  * @throws \EventEspresso\core\exceptions\InvalidEntityException
72 72
 	  */
73
-	 public function add( $object, $identifier = null ) {
74
-		 if ( ! $object instanceof $this->collection_interface ) {
75
-			 throw new InvalidEntityException( $object, $this->collection_interface );
73
+	 public function add($object, $identifier = null) {
74
+		 if ( ! $object instanceof $this->collection_interface) {
75
+			 throw new InvalidEntityException($object, $this->collection_interface);
76 76
 		 }
77
-		 $this->attach( $object );
78
-		 $this->setIdentifier( $object, $identifier );
79
-		 return $this->contains( $object );
77
+		 $this->attach($object);
78
+		 $this->setIdentifier($object, $identifier);
79
+		 return $this->contains($object);
80 80
 	 }
81 81
 
82 82
 
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 	  * @param  mixed $identifier
93 93
 	  * @return bool
94 94
 	  */
95
-	 public function setIdentifier( $object, $identifier = null ) {
96
-		 $identifier = ! empty( $identifier ) ? $identifier : spl_object_hash( $object );
95
+	 public function setIdentifier($object, $identifier = null) {
96
+		 $identifier = ! empty($identifier) ? $identifier : spl_object_hash($object);
97 97
 		 $this->rewind();
98
-		 while ( $this->valid() ) {
99
-			 if ( $object === $this->current() ) {
100
-				 $this->setInfo( $identifier );
98
+		 while ($this->valid()) {
99
+			 if ($object === $this->current()) {
100
+				 $this->setInfo($identifier);
101 101
 				 $this->rewind();
102 102
 				 return true;
103 103
 			 }
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
 	  * @param mixed $identifier
118 118
 	  * @return mixed
119 119
 	  */
120
-	 public function get( $identifier ) {
120
+	 public function get($identifier) {
121 121
 		 $this->rewind();
122
-		 while ( $this->valid() ) {
123
-			 if ( $identifier === $this->getInfo() ) {
122
+		 while ($this->valid()) {
123
+			 if ($identifier === $this->getInfo()) {
124 124
 				 $object = $this->current();
125 125
 				 $this->rewind();
126 126
 				 return $object;
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 	  * @param  mixed $identifier
143 143
 	  * @return bool
144 144
 	  */
145
-	 public function has( $identifier ) {
145
+	 public function has($identifier) {
146 146
 		 $this->rewind();
147
-		 while ( $this->valid() ) {
148
-			 if ( $identifier === $this->getInfo() ) {
147
+		 while ($this->valid()) {
148
+			 if ($identifier === $this->getInfo()) {
149 149
 				 $this->rewind();
150 150
 				 return true;
151 151
 			 }
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	  * @param $object
165 165
 	  * @return bool
166 166
 	  */
167
-	 public function hasObject( $object ) {
168
-		 return $this->contains( $object );
167
+	 public function hasObject($object) {
168
+		 return $this->contains($object);
169 169
 	 }
170 170
 
171 171
 
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 	  * @param $object
179 179
 	  * @return bool
180 180
 	  */
181
-	 public function remove( $object ) {
182
-		 $this->detach( $object );
181
+	 public function remove($object) {
182
+		 $this->detach($object);
183 183
 		 return true;
184 184
 	 }
185 185
 
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 	  * @param mixed $identifier
194 194
 	  * @return boolean
195 195
 	  */
196
-	 public function setCurrent( $identifier ) {
196
+	 public function setCurrent($identifier) {
197 197
 		 $this->rewind();
198
-		 while ( $this->valid() ) {
199
-			 if ( $identifier === $this->getInfo() ) {
198
+		 while ($this->valid()) {
199
+			 if ($identifier === $this->getInfo()) {
200 200
 				 return true;
201 201
 			 }
202 202
 			 $this->next();
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 	  * @param $object
215 215
 	  * @return boolean
216 216
 	  */
217
-	 public function setCurrentUsingObject( $object ) {
217
+	 public function setCurrentUsingObject($object) {
218 218
 		 $this->rewind();
219
-		 while ( $this->valid() ) {
220
-			 if ( $this->current() === $object ) {
219
+		 while ($this->valid()) {
220
+			 if ($this->current() === $object) {
221 221
 				 return true;
222 222
 			 }
223 223
 			 $this->next();
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 	  * @return mixed
235 235
 	  */
236 236
 	 public function previous() {
237
-		 $index = $this->indexOf( $this->current() );
238
-		 if ( $index === 0 ) {
237
+		 $index = $this->indexOf($this->current());
238
+		 if ($index === 0) {
239 239
 			 return $this->current();
240 240
 		 }
241 241
 		 $index--;
242
-		 return $this->objectAtIndex( $index );
242
+		 return $this->objectAtIndex($index);
243 243
 	 }
244 244
 
245 245
 
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
 	  * @param $object
252 252
 	  * @return boolean|int|string
253 253
 	  */
254
-	 public function indexOf( $object ) {
255
-		 if ( ! $this->contains( $object ) ) {
254
+	 public function indexOf($object) {
255
+		 if ( ! $this->contains($object)) {
256 256
 			 return false;
257 257
 		 }
258
-		 foreach ( $this as $index => $obj ) {
259
-			 if ( $obj === $object ) {
258
+		 foreach ($this as $index => $obj) {
259
+			 if ($obj === $object) {
260 260
 				 return $index;
261 261
 			 }
262 262
 		 }
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
 	  * @param int $index
273 273
 	  * @return mixed
274 274
 	  */
275
-	 public function objectAtIndex( $index ) {
276
-		 $iterator = new LimitIterator( $this, $index, 1 );
275
+	 public function objectAtIndex($index) {
276
+		 $iterator = new LimitIterator($this, $index, 1);
277 277
 		 $iterator->rewind();
278 278
 		 return $iterator->current();
279 279
 	 }
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 	  * @param int $length
289 289
 	  * @return array
290 290
 	  */
291
-	 public function slice( $offset, $length ) {
291
+	 public function slice($offset, $length) {
292 292
 		 $slice = array();
293
-		 $iterator = new LimitIterator( $this, $offset, $length );
294
-		 foreach ( $iterator as $object ) {
293
+		 $iterator = new LimitIterator($this, $offset, $length);
294
+		 foreach ($iterator as $object) {
295 295
 			 $slice[] = $object;
296 296
 		 }
297 297
 		 return $slice;
@@ -306,35 +306,35 @@  discard block
 block discarded – undo
306 306
 	  * @param mixed $objects A single object or an array of objects
307 307
 	  * @param int $index
308 308
 	  */
309
-	 public function insertAt( $objects, $index ) {
310
-		 if ( ! is_array( $objects ) ) {
311
-			 $objects = array( $objects );
309
+	 public function insertAt($objects, $index) {
310
+		 if ( ! is_array($objects)) {
311
+			 $objects = array($objects);
312 312
 		 }
313 313
 		 // check to ensure that objects don't already exist in the collection
314
-		 foreach ( $objects as $key => $object ) {
315
-			 if ( $this->contains( $object ) ) {
316
-				 unset( $objects[ $key ] );
314
+		 foreach ($objects as $key => $object) {
315
+			 if ($this->contains($object)) {
316
+				 unset($objects[$key]);
317 317
 			 }
318 318
 		 }
319 319
 		 // do we have any objects left?
320
-		 if ( ! $objects ) {
320
+		 if ( ! $objects) {
321 321
 			 return;
322 322
 		 }
323 323
 		 // detach any objects at or past this index
324 324
 		 $remaining = array();
325
-		 if ( $index < $this->count() ) {
326
-			 $remaining = $this->slice( $index, $this->count() - $index );
327
-			 foreach ( $remaining as $object ) {
328
-				 $this->detach( $object );
325
+		 if ($index < $this->count()) {
326
+			 $remaining = $this->slice($index, $this->count() - $index);
327
+			 foreach ($remaining as $object) {
328
+				 $this->detach($object);
329 329
 			 }
330 330
 		 }
331 331
 		 // add the new objects we're splicing in
332
-		 foreach ( $objects as $object ) {
333
-			 $this->attach( $object );
332
+		 foreach ($objects as $object) {
333
+			 $this->attach($object);
334 334
 		 }
335 335
 		 // attach the objects we previously detached
336
-		 foreach ( $remaining as $object ) {
337
-			 $this->attach( $object );
336
+		 foreach ($remaining as $object) {
337
+			 $this->attach($object);
338 338
 		 }
339 339
 	 }
340 340
 
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
 	  * @see http://stackoverflow.com/a/8736013
347 347
 	  * @param int $index
348 348
 	  */
349
-	 public function removeAt( $index ) {
350
-		 $this->detach( $this->objectAtIndex( $index ) );
349
+	 public function removeAt($index) {
350
+		 $this->detach($this->objectAtIndex($index));
351 351
 	 }
352 352
 
353 353
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	  *
116 116
 	  * @access public
117 117
 	  * @param mixed $identifier
118
-	  * @return mixed
118
+	  * @return boolean
119 119
 	  */
120 120
 	 public function get( $identifier ) {
121 121
 		 $this->rewind();
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	  * advances pointer to the provided object
238 238
 	  *
239 239
 	  * @access public
240
-	  * @param $object
240
+	  * @param \EventEspresso\core\libraries\form_sections\form_handlers\SequentialStepForm $object
241 241
 	  * @return boolean
242 242
 	  */
243 243
 	 public function setCurrentUsingObject( $object ) {
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	  *
276 276
 	  * @see http://stackoverflow.com/a/8736013
277 277
 	  * @param $object
278
-	  * @return boolean|int|string
278
+	  * @return integer
279 279
 	  */
280 280
 	 public function indexOf( $object ) {
281 281
 		 if ( ! $this->contains( $object ) ) {
Please login to merge, or discard this patch.
Indentation   +31 added lines, -32 removed lines patch added patch discarded remove patch
@@ -83,7 +83,6 @@  discard block
 block discarded – undo
83 83
 
84 84
 	 /**
85 85
 	  * setIdentifier
86
-
87 86
 	  * Sets the data associated with an object in the Collection
88 87
 	  * if no $identifier is supplied, then the spl_object_hash() is used
89 88
 	  *
@@ -172,9 +171,9 @@  discard block
 block discarded – undo
172 171
 
173 172
 	 /**
174 173
 	  * hasObjects
175
-      * returns true if there are objects within the Collection, and false if it is empty
176
-      *
177
-      * @access public
174
+	  * returns true if there are objects within the Collection, and false if it is empty
175
+	  *
176
+	  * @access public
178 177
 	  * @return bool
179 178
 	  */
180 179
 	 public function hasObjects() {
@@ -378,34 +377,34 @@  discard block
 block discarded – undo
378 377
 
379 378
 
380 379
 
381
-     /**
382
-      * detaches ALL objects from the Collection
383
-      */
384
-     public function detachAll()
385
-     {
386
-         $this->rewind();
387
-         while ($this->valid()) {
388
-             $object = $this->current();
389
-             $this->next();
390
-             $this->detach($object);
391
-         }
392
-     }
393
-
394
-
395
-
396
-     /**
397
-      * unsets and detaches ALL objects from the Collection
398
-      */
399
-     public function trashAndDetachAll()
400
-     {
401
-         $this->rewind();
402
-         while ($this->valid()) {
403
-             $object = $this->current();
404
-             $this->next();
405
-             $this->detach($object);
406
-             unset($object);
407
-         }
408
-     }
380
+	 /**
381
+	  * detaches ALL objects from the Collection
382
+	  */
383
+	 public function detachAll()
384
+	 {
385
+		 $this->rewind();
386
+		 while ($this->valid()) {
387
+			 $object = $this->current();
388
+			 $this->next();
389
+			 $this->detach($object);
390
+		 }
391
+	 }
392
+
393
+
394
+
395
+	 /**
396
+	  * unsets and detaches ALL objects from the Collection
397
+	  */
398
+	 public function trashAndDetachAll()
399
+	 {
400
+		 $this->rewind();
401
+		 while ($this->valid()) {
402
+			 $object = $this->current();
403
+			 $this->next();
404
+			 $this->detach($object);
405
+			 unset($object);
406
+		 }
407
+	 }
409 408
 
410 409
 
411 410
 
Please login to merge, or discard this patch.
core/services/collections/CollectionLoader.php 4 patches
Unused Use Statements   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\collections;
3 3
 
4
-use  EventEspresso\core\exceptions\InvalidClassException;
5
-use  EventEspresso\core\exceptions\InvalidDataTypeException;
6
-use  EventEspresso\core\exceptions\InvalidEntityException;
7
-use  EventEspresso\core\exceptions\InvalidFilePathException;
4
+use EventEspresso\core\exceptions\InvalidClassException;
5
+use EventEspresso\core\exceptions\InvalidDataTypeException;
6
+use EventEspresso\core\exceptions\InvalidEntityException;
7
+use EventEspresso\core\exceptions\InvalidFilePathException;
8 8
 use EventEspresso\core\services\locators\LocatorInterface;
9 9
 use EventEspresso\core\services\locators\FileLocator;
10 10
 
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 use EventEspresso\core\services\locators\LocatorInterface;
9 9
 use EventEspresso\core\services\locators\FileLocator;
10 10
 
11
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
12
-	exit( 'No direct script access allowed' );
11
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
12
+	exit('No direct script access allowed');
13 13
 }
14 14
 
15 15
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 		LocatorInterface $file_locator = null
82 82
 	) {
83 83
 		$this->collection_details = $collection_details;
84
-		if ( ! $collection instanceof CollectionInterface ) {
85
-			$collection = new Collection( $this->collection_details->getCollectionInterface() );
84
+		if ( ! $collection instanceof CollectionInterface) {
85
+			$collection = new Collection($this->collection_details->getCollectionInterface());
86 86
 		}
87 87
 		$this->collection = $collection;
88 88
 		$this->file_locator = $file_locator;
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
111 111
 	 */
112 112
 	protected function loadAllFromFilepaths() {
113
-		if ( ! $this->file_locator instanceof FileLocator ) {
113
+		if ( ! $this->file_locator instanceof FileLocator) {
114 114
 			$this->file_locator = new FileLocator();
115 115
 		}
116
-		$this->file_locator->setFileMask( $this->collection_details->getFileMask() );
116
+		$this->file_locator->setFileMask($this->collection_details->getFileMask());
117 117
 		// find all of the files that match the file mask in the specified folder
118
-		$this->file_locator->locate( $this->collection_details->getCollectionPaths() );
118
+		$this->file_locator->locate($this->collection_details->getCollectionPaths());
119 119
 		// filter the results
120 120
 		$filepaths = (array) apply_filters(
121 121
 			'FHEE__CollectionLoader__loadAllFromFilepath__filepaths',
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
 			$this->collection_details->collectionName(),
124 124
 			$this->collection_details
125 125
 		);
126
-		if ( empty( $filepaths ) ) {
126
+		if (empty($filepaths)) {
127 127
 			return;
128 128
 		}
129
-		foreach ( $filepaths as $filepath ) {
130
-			$this->loadClassFromFilepath( $filepath );
129
+		foreach ($filepaths as $filepath) {
130
+			$this->loadClassFromFilepath($filepath);
131 131
 		}
132 132
 	}
133 133
 
@@ -144,22 +144,22 @@  discard block
 block discarded – undo
144 144
 	 * @throws \EventEspresso\core\exceptions\InvalidFilePathException
145 145
 	 * @throws \EventEspresso\core\exceptions\InvalidClassException
146 146
 	 */
147
-	protected function loadClassFromFilepath( $filepath ) {
148
-		if ( ! is_string( $filepath ) ) {
149
-			throw new InvalidDataTypeException( '$filepath', $filepath, 'string' );
147
+	protected function loadClassFromFilepath($filepath) {
148
+		if ( ! is_string($filepath)) {
149
+			throw new InvalidDataTypeException('$filepath', $filepath, 'string');
150 150
 		}
151
-		if ( ! is_readable( $filepath ) ) {
152
-			throw new InvalidFilePathException( $filepath );
151
+		if ( ! is_readable($filepath)) {
152
+			throw new InvalidFilePathException($filepath);
153 153
 		}
154
-		require_once( $filepath );
154
+		require_once($filepath);
155 155
 		// extract filename from path
156
-		$file_name = basename( $filepath );
156
+		$file_name = basename($filepath);
157 157
 		// now remove any file extensions
158
-		$class_name = \EEH_File::get_classname_from_filepath_with_standard_filename( $file_name );
159
-		if ( ! class_exists( $class_name ) ) {
160
-			throw new InvalidClassException( $class_name );
158
+		$class_name = \EEH_File::get_classname_from_filepath_with_standard_filename($file_name);
159
+		if ( ! class_exists($class_name)) {
160
+			throw new InvalidClassException($class_name);
161 161
 		}
162
-		return $this->addEntityToCollection( new $class_name(), $file_name );
162
+		return $this->addEntityToCollection(new $class_name(), $file_name);
163 163
 	}
164 164
 
165 165
 
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
 	 * @return string
174 174
 	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
175 175
 	 */
176
-	protected function addEntityToCollection( $entity, $identifier ) {
176
+	protected function addEntityToCollection($entity, $identifier) {
177 177
 		do_action(
178 178
 			'FHEE__CollectionLoader__addEntityToCollection__entity',
179 179
 			$entity,
180 180
 			$this->collection_details->collectionName(),
181 181
 			$this->collection_details
182 182
 		);
183
-		$identifier = $this->setIdentifier( $entity, $identifier );
184
-		if ( $this->collection->has( $identifier ) ) {
183
+		$identifier = $this->setIdentifier($entity, $identifier);
184
+		if ($this->collection->has($identifier)) {
185 185
 			do_action(
186 186
 				'FHEE__CollectionLoader__addEntityToCollection__entity_already_added',
187 187
 				$this,
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 			);
191 191
 			return CollectionLoader::ENTITY_EXISTS;
192 192
 		}
193
-		if( $this->collection->add( $entity, $identifier ) ) {
193
+		if ($this->collection->add($entity, $identifier)) {
194 194
 			do_action(
195 195
 				'FHEE__CollectionLoader__addEntityToCollection__entity_added',
196 196
 				$this,
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 	 * @return string
221 221
 	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
222 222
 	 */
223
-	protected function setIdentifier( $entity, $identifier ) {
224
-	    switch($this->collection_details->identifierType()) {
223
+	protected function setIdentifier($entity, $identifier) {
224
+	    switch ($this->collection_details->identifierType()) {
225 225
 	        // every unique object gets added to the collection, but not duplicates of the exact same object
226 226
             case CollectionDetails::ID_OBJECT_HASH :
227 227
                 $identifier = spl_object_hash($entity);
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 			$this->collection_details->collectionName(),
279 279
 			$this->collection_details
280 280
 		);
281
-		foreach ( $FQCNs as $FQCN ) {
282
-			$this->loadClassFromFQCN( $FQCN );
281
+		foreach ($FQCNs as $FQCN) {
282
+			$this->loadClassFromFQCN($FQCN);
283 283
 		}
284 284
 	}
285 285
 
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
296 296
 	 * @throws \EventEspresso\core\exceptions\InvalidClassException
297 297
 	 */
298
-	protected function loadClassFromFQCN( $FQCN ) {
299
-		if ( ! is_string( $FQCN ) ) {
300
-			throw new InvalidDataTypeException( '$FQCN', $FQCN, 'string' );
298
+	protected function loadClassFromFQCN($FQCN) {
299
+		if ( ! is_string($FQCN)) {
300
+			throw new InvalidDataTypeException('$FQCN', $FQCN, 'string');
301 301
 		}
302
-		if ( ! class_exists( $FQCN ) ) {
303
-			throw new InvalidClassException( $FQCN );
302
+		if ( ! class_exists($FQCN)) {
303
+			throw new InvalidClassException($FQCN);
304 304
 		}
305 305
 		return $this->addEntityToCollection(
306
-			\EE_Registry::instance()->create( $FQCN ),
306
+			\EE_Registry::instance()->create($FQCN),
307 307
 			$FQCN
308 308
 		);
309 309
 	}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@
 block discarded – undo
169 169
 	 *
170 170
 	 * @access protected
171 171
 	 * @param        $entity
172
-	 * @param  mixed $identifier
172
+	 * @param  string $identifier
173 173
 	 * @return string
174 174
 	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
175 175
 	 */
Please login to merge, or discard this patch.
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 			);
200 200
 			return CollectionLoader::ENTITY_ADDED;
201 201
 		}
202
-        do_action(
203
-            'FHEE__CollectionLoader__addEntityToCollection__entity_not_added',
204
-            $this,
205
-            $this->collection_details->collectionName(),
206
-            $this->collection_details
207
-        );
208
-        return CollectionLoader::ENTITY_NOT_ADDED;
202
+		do_action(
203
+			'FHEE__CollectionLoader__addEntityToCollection__entity_not_added',
204
+			$this,
205
+			$this->collection_details->collectionName(),
206
+			$this->collection_details
207
+		);
208
+		return CollectionLoader::ENTITY_NOT_ADDED;
209 209
 	}
210 210
 
211 211
 
@@ -220,37 +220,37 @@  discard block
 block discarded – undo
220 220
 	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
221 221
 	 */
222 222
 	protected function setIdentifier( $entity, $identifier ) {
223
-	    switch($this->collection_details->identifierType()) {
224
-	        // every unique object gets added to the collection, but not duplicates of the exact same object
225
-            case CollectionDetails::ID_OBJECT_HASH :
226
-                $identifier = spl_object_hash($entity);
227
-                break;
228
-            // only one entity per class can be added to collection, like a singleton
229
-            case CollectionDetails::ID_CLASS_NAME :
230
-                $identifier = get_class($entity);
231
-                break;
232
-            // objects added to the collection based on entity callback, so the entity itself decides
233
-            case CollectionDetails::ID_CALLBACK_METHOD :
234
-                $identifier_callback = $this->collection_details->identifierCallback();
235
-                if ( ! method_exists($entity, $identifier_callback)) {
236
-                    throw new InvalidEntityException(
237
-                        $entity,
238
-                        $this->collection_details->getCollectionInterface(),
239
-                        sprintf(
240
-                            __(
241
-                                'The current collection is configured to use a method named "%1$s" when setting or retrieving objects. The supplied entity is an instance
223
+		switch($this->collection_details->identifierType()) {
224
+			// every unique object gets added to the collection, but not duplicates of the exact same object
225
+			case CollectionDetails::ID_OBJECT_HASH :
226
+				$identifier = spl_object_hash($entity);
227
+				break;
228
+			// only one entity per class can be added to collection, like a singleton
229
+			case CollectionDetails::ID_CLASS_NAME :
230
+				$identifier = get_class($entity);
231
+				break;
232
+			// objects added to the collection based on entity callback, so the entity itself decides
233
+			case CollectionDetails::ID_CALLBACK_METHOD :
234
+				$identifier_callback = $this->collection_details->identifierCallback();
235
+				if ( ! method_exists($entity, $identifier_callback)) {
236
+					throw new InvalidEntityException(
237
+						$entity,
238
+						$this->collection_details->getCollectionInterface(),
239
+						sprintf(
240
+							__(
241
+								'The current collection is configured to use a method named "%1$s" when setting or retrieving objects. The supplied entity is an instance
242 242
                                 of "%2$s", but does not contain this method.',
243
-                                'event_espresso'
244
-                            ),
245
-                            $identifier_callback,
246
-                            get_class($entity)
247
-                        )
248
-                    );
249
-                }
250
-                $identifier = $entity->{$identifier_callback}();
251
-                break;
252
-
253
-        }
243
+								'event_espresso'
244
+							),
245
+							$identifier_callback,
246
+							get_class($entity)
247
+						)
248
+					);
249
+				}
250
+				$identifier = $entity->{$identifier_callback}();
251
+				break;
252
+
253
+		}
254 254
 		return apply_filters(
255 255
 			'FHEE__CollectionLoader__addEntityToCollection__identifier',
256 256
 			$identifier,
Please login to merge, or discard this patch.
core/services/locators/FileLocator.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\locators;
3 3
 
4
-use  EventEspresso\core\exceptions\InvalidDataTypeException;
4
+use EventEspresso\core\exceptions\InvalidDataTypeException;
5 5
 use FilesystemIterator;
6 6
 use GlobIterator;
7 7
 
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 use FilesystemIterator;
6 6
 use GlobIterator;
7 7
 
8
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
9
-	exit( 'No direct script access allowed' );
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10 10
 }
11 11
 
12 12
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	 * @param string $file_mask
39 39
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
40 40
 	 */
41
-	public function setFileMask( $file_mask ) {
42
-		if ( ! is_string( $file_mask ) ) {
43
-			throw new InvalidDataTypeException( '$file_mask', $file_mask, 'string' );
41
+	public function setFileMask($file_mask) {
42
+		if ( ! is_string($file_mask)) {
43
+			throw new InvalidDataTypeException('$file_mask', $file_mask, 'string');
44 44
 		}
45 45
 		$this->file_mask = $file_mask;
46 46
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return int
64 64
 	 */
65 65
 	public function count() {
66
-		return count( $this->filepaths );
66
+		return count($this->filepaths);
67 67
 	}
68 68
 
69 69
 
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 	 * @return \FilesystemIterator
78 78
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
79 79
 	 */
80
-	public function locate( $directory_paths ) {
81
-		if ( ! ( is_string( $directory_paths ) || is_array( $directory_paths ) ) ) {
82
-			throw new InvalidDataTypeException( '$directory_paths', $directory_paths, 'string or array' );
80
+	public function locate($directory_paths) {
81
+		if ( ! (is_string($directory_paths) || is_array($directory_paths))) {
82
+			throw new InvalidDataTypeException('$directory_paths', $directory_paths, 'string or array');
83 83
 		}
84
-		foreach ( (array) $directory_paths as $directory_path ) {
85
-			foreach ( $this->findFilesByPath( $directory_path ) as $key => $file ) {
86
-				$this->filepaths[ $key ] = \EEH_File::standardise_directory_separators( $file );
84
+		foreach ((array) $directory_paths as $directory_path) {
85
+			foreach ($this->findFilesByPath($directory_path) as $key => $file) {
86
+				$this->filepaths[$key] = \EEH_File::standardise_directory_separators($file);
87 87
 			}
88 88
 		}
89 89
 		return $this->filepaths;
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	 * @param string $directory_path
99 99
 	 * @return \FilesystemIterator
100 100
 	 */
101
-	protected function findFilesByPath( $directory_path = '' ) {
102
-		$iterator = new GlobIterator (
103
-			\EEH_File::end_with_directory_separator( $directory_path ) . $this->file_mask
101
+	protected function findFilesByPath($directory_path = '') {
102
+		$iterator = new GlobIterator(
103
+			\EEH_File::end_with_directory_separator($directory_path).$this->file_mask
104 104
 		);
105
-		foreach ( $this->flags as $flag ) {
106
-			$iterator->setFlags( $flag );
105
+		foreach ($this->flags as $flag) {
106
+			$iterator->setFlags($flag);
107 107
 		}
108 108
 		return $iterator;
109 109
 	}
Please login to merge, or discard this patch.
core/services/locators/FqcnLocator.php 3 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\locators;
3 3
 
4
-use  EventEspresso\core\exceptions\InvalidClassException;
5
-use  EventEspresso\core\exceptions\InvalidDataTypeException;
4
+use EventEspresso\core\exceptions\InvalidClassException;
5
+use EventEspresso\core\exceptions\InvalidDataTypeException;
6 6
 use EventEspresso\Core\Psr4Autoloader;
7 7
 use FilesystemIterator;
8 8
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 	 * given a valid namespace, will find all files that match the provided mask
78 78
 	 *
79 79
 	 * @access public
80
-	 * @param string|array $namespaces
80
+	 * @param string $namespaces
81 81
 	 * @return FilesystemIterator
82 82
 	 * @throws \EventEspresso\core\exceptions\InvalidClassException
83 83
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\Core\Psr4Autoloader;
7 7
 use FilesystemIterator;
8 8
 
9
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
10
-	exit( 'No direct script access allowed' );
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 	 * @param string $namespace_base_dir
41 41
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
42 42
 	 */
43
-	protected function setNamespace( $namespace, $namespace_base_dir ) {
44
-		if ( ! is_string( $namespace ) ) {
45
-			throw new InvalidDataTypeException( '$namespace', $namespace, 'string' );
43
+	protected function setNamespace($namespace, $namespace_base_dir) {
44
+		if ( ! is_string($namespace)) {
45
+			throw new InvalidDataTypeException('$namespace', $namespace, 'string');
46 46
 		}
47
-		if ( ! is_string( $namespace_base_dir ) ) {
48
-			throw new InvalidDataTypeException( '$namespace_base_dir', $namespace_base_dir, 'string' );
47
+		if ( ! is_string($namespace_base_dir)) {
48
+			throw new InvalidDataTypeException('$namespace_base_dir', $namespace_base_dir, 'string');
49 49
 		}
50
-		$this->namespaces[ $namespace ] = $namespace_base_dir;
50
+		$this->namespaces[$namespace] = $namespace_base_dir;
51 51
 	}
52 52
 
53 53
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @return int
68 68
 	 */
69 69
 	public function count() {
70
-		return count( $this->FQCNs );
70
+		return count($this->FQCNs);
71 71
 	}
72 72
 
73 73
 
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 	 * @throws \EventEspresso\core\exceptions\InvalidClassException
83 83
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
84 84
 	 */
85
-	public function locate( $namespaces ) {
86
-		if ( ! ( is_string( $namespaces ) || is_array( $namespaces ) ) ) {
87
-			throw new InvalidDataTypeException( '$namespaces', $namespaces, 'string or array' );
85
+	public function locate($namespaces) {
86
+		if ( ! (is_string($namespaces) || is_array($namespaces))) {
87
+			throw new InvalidDataTypeException('$namespaces', $namespaces, 'string or array');
88 88
 		}
89
-		foreach ( (array) $namespaces as $namespace ) {
90
-			foreach ( $this->FindFQCNsByNamespace( $namespace ) as $key => $file ) {
91
-				$this->FQCNs[ $key ] = $file;
89
+		foreach ((array) $namespaces as $namespace) {
90
+			foreach ($this->FindFQCNsByNamespace($namespace) as $key => $file) {
91
+				$this->FQCNs[$key] = $file;
92 92
 			}
93 93
 		}
94 94
 		return $this->FQCNs;
@@ -107,24 +107,24 @@  discard block
 block discarded – undo
107 107
 	 * @throws \EventEspresso\core\exceptions\InvalidClassException
108 108
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
109 109
 	 */
110
-	protected function FindFQCNsByNamespace( $partial_namespace ) {
110
+	protected function FindFQCNsByNamespace($partial_namespace) {
111 111
 		$iterator = new FilesystemIterator(
112
-			$this->getDirectoryFromPartialNamespace( $partial_namespace )
112
+			$this->getDirectoryFromPartialNamespace($partial_namespace)
113 113
 		);
114
-		foreach ( $this->flags as $flag ) {
115
-			$iterator->setFlags( $flag );
114
+		foreach ($this->flags as $flag) {
115
+			$iterator->setFlags($flag);
116 116
 		}
117
-		if ( iterator_count( $iterator ) === 0 ) {
117
+		if (iterator_count($iterator) === 0) {
118 118
 			return array();
119 119
 		}
120
-		foreach ( $iterator as $file ) {
121
-			$file = \EEH_File::standardise_directory_separators( $file );
122
-			foreach ( $this->namespaces as $namespace => $base_dir ) {
120
+		foreach ($iterator as $file) {
121
+			$file = \EEH_File::standardise_directory_separators($file);
122
+			foreach ($this->namespaces as $namespace => $base_dir) {
123 123
 				$namespace .= Psr4Autoloader::NS;
124
-				if ( strpos( $file, $base_dir ) === 0 ) {
125
-					$this->FQCNs[] = Psr4Autoloader::NS . str_replace(
126
-							array( $base_dir, DS, '.php' ),
127
-							array( $namespace, Psr4Autoloader::NS, '' ),
124
+				if (strpos($file, $base_dir) === 0) {
125
+					$this->FQCNs[] = Psr4Autoloader::NS.str_replace(
126
+							array($base_dir, DS, '.php'),
127
+							array($namespace, Psr4Autoloader::NS, ''),
128 128
 							$file
129 129
 						);
130 130
 				}
@@ -144,25 +144,25 @@  discard block
 block discarded – undo
144 144
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
145 145
 	 * @throws \EventEspresso\core\exceptions\InvalidClassException
146 146
 	 */
147
-	protected function getDirectoryFromPartialNamespace( $partial_namespace ) {
148
-		if ( empty( $partial_namespace ) ) {
149
-			throw new InvalidClassException( $partial_namespace );
147
+	protected function getDirectoryFromPartialNamespace($partial_namespace) {
148
+		if (empty($partial_namespace)) {
149
+			throw new InvalidClassException($partial_namespace);
150 150
 		}
151 151
 		// load our PSR-4 Autoloader so we can get the list of registered namespaces from it
152 152
 		$psr4_loader = \EE_Psr4AutoloaderInit::psr4_loader();
153 153
 		// breakup the incoming namespace into segments then loop thru them
154
-		$namespace_segments = explode( Psr4Autoloader::NS, trim( $partial_namespace, Psr4Autoloader::NS ) );
154
+		$namespace_segments = explode(Psr4Autoloader::NS, trim($partial_namespace, Psr4Autoloader::NS));
155 155
 		// we're only interested in the first element, so pull that from the array
156
-		$namespace = array_shift( $namespace_segments );
156
+		$namespace = array_shift($namespace_segments);
157 157
 		// check if there's a base directory registered for that namespace
158
-		$prefix = $psr4_loader->prefixes( $namespace . Psr4Autoloader::NS );
158
+		$prefix = $psr4_loader->prefixes($namespace.Psr4Autoloader::NS);
159 159
 		// nope? then the incoming namespace is invalid
160
-		if ( empty( $prefix ) || empty( $prefix[0] ) ) {
161
-			throw new InvalidClassException( $partial_namespace );
160
+		if (empty($prefix) || empty($prefix[0])) {
161
+			throw new InvalidClassException($partial_namespace);
162 162
 		}
163
-		$this->setNamespace( $namespace, $prefix[0] );
163
+		$this->setNamespace($namespace, $prefix[0]);
164 164
 		// but if it's good, add that base directory to the rest of the path, and return it
165
-		return $prefix[0] . implode( DS, $namespace_segments ) . DS;
165
+		return $prefix[0].implode(DS, $namespace_segments).DS;
166 166
 	}
167 167
 
168 168
 
Please login to merge, or discard this patch.
core/services/commands/InvalidCommandHandlerException.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\commands;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 * @param  int        $code
26 26
 	 * @param  \Exception $previous
27 27
 	 */
28
-	public function __construct( $command_name, $message = '', $code = 0, \Exception $previous = null ) {
29
-		if ( empty( $message ) ) {
28
+	public function __construct($command_name, $message = '', $code = 0, \Exception $previous = null) {
29
+		if (empty($message)) {
30 30
 			$message = sprintf(
31
-				__( 'The supplied Command Handler "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', 'event_espresso' ),
31
+				__('The supplied Command Handler "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', 'event_espresso'),
32 32
 				$command_name
33 33
 			);
34 34
 		}
35
-		parent::__construct( $message, $code, $previous );
35
+		parent::__construct($message, $code, $previous);
36 36
 	}
37 37
 
38 38
 }
Please login to merge, or discard this patch.
core/services/commands/CommandHandlerInterface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\commands;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * @param \EventEspresso\core\services\commands\CommandInterface $command
20 20
 	 * @return mixed
21 21
 	 */
22
-	public function handle( CommandInterface $command );
22
+	public function handle(CommandInterface $command);
23 23
 
24 24
 }
25 25
 // End of file CommandHandlerInterface.php
Please login to merge, or discard this patch.