Completed
Branch BUG-10526-failing-rest-unit-te... (4b9b86)
by
unknown
156:45 queued 144:18
created
templates/thank-you-page-registration-details.template.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,81 +5,81 @@  discard block
 block discarded – undo
5 5
 /** @type string $SPCO_attendee_information_url */
6 6
 ?>
7 7
 <h3 class="ee-registration-details-h3"><?php _e('Registration Details', 'event_espresso'); ?></h3>
8
-<?php  do_action( 'AHEE__thank_you_page_registration_details_template__after_heading' ); ?>
8
+<?php  do_action('AHEE__thank_you_page_registration_details_template__after_heading'); ?>
9 9
 
10 10
 <div class="ee-registration-details-dv">
11 11
 <?php
12 12
 $registrations = $transaction->registrations();
13
-$registrations = is_array( $registrations ) ? $registrations : array();
14
-$reg_count = count( $registrations );
13
+$registrations = is_array($registrations) ? $registrations : array();
14
+$reg_count = count($registrations);
15 15
 $reg_cntr = 0;
16 16
 $event_name = '';
17 17
 $wait_list = false;
18
-foreach ( $registrations as $registration ) {
19
-	if ( $registration instanceof EE_Registration ) {
20
-		if ( $event_name != $registration->event_name() && ! empty( $event_name )) { ?>
18
+foreach ($registrations as $registration) {
19
+	if ($registration instanceof EE_Registration) {
20
+		if ($event_name != $registration->event_name() && ! empty($event_name)) { ?>
21 21
 		</tbody>
22 22
 	</table>
23 23
 		<?php
24 24
 		}
25 25
 		$reg_cntr++;
26
-		if ( $event_name != $registration->event_name() ) {
26
+		if ($event_name != $registration->event_name()) {
27 27
 	?>
28 28
 	<h5>
29
-		<span class="smaller-text grey-text"><?php _e('for','event_espresso');?>: </span> <?php echo htmlentities( $registration->event_name(), ENT_QUOTES, 'UTF-8' );?>
29
+		<span class="smaller-text grey-text"><?php _e('for', 'event_espresso'); ?>: </span> <?php echo htmlentities($registration->event_name(), ENT_QUOTES, 'UTF-8'); ?>
30 30
 	</h5>
31 31
 	<table class='ee-table ee-registrations-list'>
32 32
 		<thead>
33 33
 			<tr>
34 34
 				<th width="40%">
35
-					<?php _e("Registrant Name",'event_espresso')?>
35
+					<?php _e("Registrant Name", 'event_espresso')?>
36 36
 				</th>
37 37
 				<th width="25%" class="jst-left">
38
-					<?php _e("REG Code",'event_espresso');?>
38
+					<?php _e("REG Code", 'event_espresso'); ?>
39 39
 				</th>
40 40
 				<th width="35%" class="jst-left">
41
-					<?php _e("REG Status",'event_espresso');?>
41
+					<?php _e("REG Status", 'event_espresso'); ?>
42 42
 				</th>
43 43
 			</tr>
44 44
 		</thead>
45 45
 		<tbody>
46 46
 	<?php
47 47
 		}
48
-		if ( $is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link() )) { ?>
48
+		if ($is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
49 49
 			<tr>
50 50
 				<td width="40%">
51 51
 				<?php
52
-					if ( $registration->attendee() instanceof EE_Attendee ) {
53
-						echo $registration->attendee()->full_name( TRUE );
52
+					if ($registration->attendee() instanceof EE_Attendee) {
53
+						echo $registration->attendee()->full_name(TRUE);
54 54
 					}
55 55
 				?>
56 56
 					<p class="tiny-text" style="margin: .75em 0 0;">
57 57
 					<?php
58
-					if ( $registration->count_question_groups() ) {
58
+					if ($registration->count_question_groups()) {
59 59
 					?>
60
-						<a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url();?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso');?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso');?></a>
60
+						<a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url(); ?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso'); ?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso'); ?></a>
61 61
 					<?php } ?>
62
-						<a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg( array( 'token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true' ), EE_Registry::instance()->CFG->core->thank_you_page_url() );?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso');?>" rel="<?php echo $registration->reg_url_link();?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso');?></a>
62
+						<a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg(array('token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true'), EE_Registry::instance()->CFG->core->thank_you_page_url()); ?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso'); ?>" rel="<?php echo $registration->reg_url_link(); ?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso'); ?></a>
63 63
 					</p>
64 64
 				</td>
65 65
 				<td width="25%" class="jst-left">
66 66
 					<?php $registration->e('REG_code') ?>
67 67
 				</td>
68 68
 				<td width="35%" class="jst-left">
69
-					<?php $registration->e_pretty_status( TRUE )?>
69
+					<?php $registration->e_pretty_status(TRUE)?>
70 70
 					<?php
71
-						if ( $registration->status_ID() === EEM_Registration::status_id_wait_list ) {
71
+						if ($registration->status_ID() === EEM_Registration::status_id_wait_list) {
72 72
 							$wait_list = true;
73 73
 						}
74 74
 					?>
75 75
 				</td>
76 76
 			</tr>
77
-            <?php  do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration ); ?>
77
+            <?php  do_action('AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration); ?>
78 78
         <?php
79 79
 			$event_name = $registration->event_name();
80 80
 
81 81
 		}
82
-		if ( $reg_cntr >= $reg_count ) {
82
+		if ($reg_cntr >= $reg_count) {
83 83
 			?>
84 84
 			</tbody>
85 85
 			</table>
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 	}
89 89
 }
90 90
 ?>
91
-<?php if ( $is_primary && $SPCO_attendee_information_url ) { ?>
91
+<?php if ($is_primary && $SPCO_attendee_information_url) { ?>
92 92
 	<p class="small-text jst-rght">
93 93
 		<a href='<?php echo $SPCO_attendee_information_url?>'><?php _e("Click here to edit All Attendee Information", 'event_espresso'); ?></a>
94 94
 	</p>
95 95
 <?php } ?>
96
-	<?php if ( $wait_list ) { ?>
96
+	<?php if ($wait_list) { ?>
97 97
 
98 98
 			<?php
99 99
 			echo apply_filters(
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	<?php } ?>
114 114
 
115 115
 
116
-	<?php  do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_details' ); ?>
116
+	<?php  do_action('AHEE__thank_you_page_registration_details_template__after_registration_details'); ?>
117 117
 
118 118
 </div>
119 119
 <!-- end of .registration-details -->
Please login to merge, or discard this patch.
modules/mijireh_payment_checker/EED_Mijireh_Payment_Checker.module.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  * @author				Mike Nelson
20 20
  *
21 21
  */
22
-class EED_Mijireh_Payment_Checker extends EED_Module{
22
+class EED_Mijireh_Payment_Checker extends EED_Module {
23 23
 
24 24
 	/**
25 25
 	 * 	set_hooks - for hooking into EE Core, other modules, etc
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 	 *  @return 	void
41 41
 	 */
42 42
 	public static function set_hooks_admin() {
43
-		add_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', array( 'EED_Mijireh_Payment_Checker', 'check_for_payment_update_on_transaction' ), 10, 1 );
43
+		add_action('AHEE__Transactions_Admin_Page__transaction_details__start', array('EED_Mijireh_Payment_Checker', 'check_for_payment_update_on_transaction'), 10, 1);
44 44
 	}
45 45
 
46
-	public static function check_for_payment_update_on_transaction( $transaction ) {
47
-		if( $transaction instanceof EE_Transaction ) {
46
+	public static function check_for_payment_update_on_transaction($transaction) {
47
+		if ($transaction instanceof EE_Transaction) {
48 48
 			$last_payment = $transaction->last_payment();
49 49
 			//if this payment is from Mijireh and so far unapproved
50
-			if(
50
+			if (
51 51
 				$last_payment instanceof EE_Payment &&
52 52
 				$last_payment->payment_method() instanceof EE_Payment_Method &&
53 53
 				$last_payment->payment_method()->type_obj() instanceof EE_PMT_Mijireh &&
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 			) {
56 56
 				add_action(
57 57
 					'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
58
-					array( 'EED_Mijireh_Payment_Checker', 'send_notifications_after_mijireh_ipn' ),
58
+					array('EED_Mijireh_Payment_Checker', 'send_notifications_after_mijireh_ipn'),
59 59
 					5, 2
60 60
 				);
61
-				EE_Payment_Processor::instance()->process_ipn( array(), $transaction, $last_payment->payment_method() );
61
+				EE_Payment_Processor::instance()->process_ipn(array(), $transaction, $last_payment->payment_method());
62 62
 			}
63 63
 		}
64 64
 	}
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 	 * @param EE_Registration $registration
75 75
 	 * @param array $additional_details
76 76
 	 */
77
-	public static function send_notifications_after_mijireh_ipn( $registration, $additional_details ) {
78
-		$last_payment = isset( $additional_details[ 'last_payment' ] ) ? $additional_details[ 'last_payment' ] : null;
79
-		if ( ! $last_payment instanceof EE_Payment || $last_payment->status() != EEM_Payment::status_id_approved ) {
80
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
77
+	public static function send_notifications_after_mijireh_ipn($registration, $additional_details) {
78
+		$last_payment = isset($additional_details['last_payment']) ? $additional_details['last_payment'] : null;
79
+		if ( ! $last_payment instanceof EE_Payment || $last_payment->status() != EEM_Payment::status_id_approved) {
80
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
81 81
 		}
82 82
 	}
83 83
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @access    public
90 90
 	 * @param WP_Query $WP_Query
91 91
 	 */
92
-	public function run( $WP_Query = null ) {
92
+	public function run($WP_Query = null) {
93 93
 	}
94 94
 }
95 95
 
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/model/Meta.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 use EventEspresso\core\libraries\rest_api\Model_Data_Translator;
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
 /**
@@ -25,20 +25,20 @@  discard block
 block discarded – undo
25 25
 	 * @param \WP_REST_Request $request
26 26
 	 * @return array|\WP_REST_Response
27 27
 	 */
28
-	public static function handle_request_models_meta( \WP_REST_Request $request ) {
28
+	public static function handle_request_models_meta(\WP_REST_Request $request) {
29 29
 		$controller = new Meta();
30
-		try{
30
+		try {
31 31
 			$matches = $controller->parse_route(
32 32
 				$request->get_route(),
33
-				'~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . 'resources~',
34
-				array( 'version' ) );
35
-			if( $matches instanceof \WP_REST_Response ) {
33
+				'~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'resources~',
34
+				array('version') );
35
+			if ($matches instanceof \WP_REST_Response) {
36 36
 				return $matches;
37 37
 			}
38
-			$controller->set_requested_version( $matches[ 'version' ] );
39
-			return $controller->send_response( $controller->_get_models_metadata_entity() );
40
-		} catch( \Exception $e ) {
41
-			return $controller->send_response( $e );
38
+			$controller->set_requested_version($matches['version']);
39
+			return $controller->send_response($controller->_get_models_metadata_entity());
40
+		} catch (\Exception $e) {
41
+			return $controller->send_response($e);
42 42
 		}
43 43
 	}
44 44
 
@@ -46,22 +46,22 @@  discard block
 block discarded – undo
46 46
 	 * Gets the model metadata resource entity
47 47
 	 * @return array for JSON response, describing all the models available in teh requested version
48 48
 	 */
49
-	protected function _get_models_metadata_entity(){
49
+	protected function _get_models_metadata_entity() {
50 50
 		$response = array();
51
-		foreach( $this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname ){
52
-			$model = $this->get_model_version_info()->load_model( $model_name );
51
+		foreach ($this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname) {
52
+			$model = $this->get_model_version_info()->load_model($model_name);
53 53
 			$fields_json = array();
54
-			foreach( $this->get_model_version_info()->fields_on_model_in_this_version( $model ) as $field_name => $field_obj ) {
55
-				if( $this->get_model_version_info()->field_is_ignored( $field_obj ) ) {
54
+			foreach ($this->get_model_version_info()->fields_on_model_in_this_version($model) as $field_name => $field_obj) {
55
+				if ($this->get_model_version_info()->field_is_ignored($field_obj)) {
56 56
 					continue;
57 57
 				}
58
-				if( $field_obj instanceof \EE_Boolean_Field ) {
58
+				if ($field_obj instanceof \EE_Boolean_Field) {
59 59
 					$datatype = 'Boolean';
60
-				}elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
60
+				}elseif ($field_obj->get_wpdb_data_type() == '%d') {
61 61
 					$datatype = 'Number';
62
-				}elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
62
+				}elseif ($field_name instanceof \EE_Serialized_Text_Field) {
63 63
 					$datatype = 'Object';
64
-				}else{
64
+				} else {
65 65
 					$datatype = 'String';
66 66
 				}
67 67
 				$default_value = Model_Data_Translator::prepare_field_value_for_json(
@@ -72,30 +72,30 @@  discard block
 block discarded – undo
72 72
 				$field_json = array(
73 73
 					'name' => $field_name,
74 74
 					'nicename' => $field_obj->get_nicename(),
75
-					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format( $field_obj ),
76
-					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format( $field_obj ),
77
-					'type' => str_replace('EE_', '', get_class( $field_obj ) ),
75
+					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format($field_obj),
76
+					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format($field_obj),
77
+					'type' => str_replace('EE_', '', get_class($field_obj)),
78 78
 					'datatype' => $datatype,
79 79
 					'nullable' => $field_obj->is_nullable(),
80 80
 					'default' => $default_value,
81 81
 					'table_alias' => $field_obj->get_table_alias(),
82 82
 					'table_column' => $field_obj->get_table_column(),
83 83
 				);
84
-				$fields_json[ $field_json[ 'name' ] ] = $field_json;
84
+				$fields_json[$field_json['name']] = $field_json;
85 85
 
86 86
 			}
87
-			$fields_json = array_merge( $fields_json, $this->get_model_version_info()->extra_resource_properties_for_model( $model ) );
88
-			$response[ $model_name ]['fields'] = apply_filters( 'FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model );
87
+			$fields_json = array_merge($fields_json, $this->get_model_version_info()->extra_resource_properties_for_model($model));
88
+			$response[$model_name]['fields'] = apply_filters('FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model);
89 89
 			$relations_json = array();
90
-			foreach( $model->relation_settings()  as $relation_name => $relation_obj ) {
90
+			foreach ($model->relation_settings()  as $relation_name => $relation_obj) {
91 91
 				$relation_json = array(
92 92
 					'name' => $relation_name,
93
-					'type' => str_replace( 'EE_', '', get_class( $relation_obj ) ),
93
+					'type' => str_replace('EE_', '', get_class($relation_obj)),
94 94
 					'single' => $relation_obj instanceof \EE_Belongs_To_Relation ? true : false,
95 95
 				);
96
-				$relations_json[ $relation_name ] = $relation_json;
96
+				$relations_json[$relation_name] = $relation_json;
97 97
 			}
98
-			$response[ $model_name ][ 'relations' ] = apply_filters( 'FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model );
98
+			$response[$model_name]['relations'] = apply_filters('FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model);
99 99
 		}
100 100
 		return $response;
101 101
 	}
@@ -105,24 +105,24 @@  discard block
 block discarded – undo
105 105
 	 * @param \WP_REST_Response $rest_response_obj
106 106
 	 * @return \WP_REST_Response
107 107
 	 */
108
-	public static function filter_ee_metadata_into_index( \WP_REST_Response $rest_response_obj ) {
108
+	public static function filter_ee_metadata_into_index(\WP_REST_Response $rest_response_obj) {
109 109
 		$response_data = $rest_response_obj->get_data();
110 110
 		$addons = array();
111
-		foreach( \EE_Registry::instance()->addons as $addon){
111
+		foreach (\EE_Registry::instance()->addons as $addon) {
112 112
 			$addon_json = array(
113 113
 				'name' => $addon->name(),
114 114
 				'version' => $addon->version()
115 115
 			);
116
-			$addons[ $addon_json[ 'name' ] ] = $addon_json;
116
+			$addons[$addon_json['name']] = $addon_json;
117 117
 		}
118
-		$response_data[ 'ee' ] = array(
118
+		$response_data['ee'] = array(
119 119
 			'version' => \EEM_System_Status::instance()->get_ee_version(),
120 120
 			'documentation_url' => 'https://github.com/eventespresso/event-espresso-core/tree/master/docs/C--REST-API',
121 121
 			'addons' => $addons,
122 122
 			'maintenance_mode' => \EE_Maintenance_Mode::instance()->real_level(),
123
-			'served_core_versions' => array_keys( \EED_Core_Rest_Api::versions_served() ),
123
+			'served_core_versions' => array_keys(\EED_Core_Rest_Api::versions_served()),
124 124
 		);
125
-		$rest_response_obj->set_data( $response_data );
125
+		$rest_response_obj->set_data($response_data);
126 126
 		return $rest_response_obj;
127 127
 	}
128 128
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,11 +57,11 @@
 block discarded – undo
57 57
 				}
58 58
 				if( $field_obj instanceof \EE_Boolean_Field ) {
59 59
 					$datatype = 'Boolean';
60
-				}elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
60
+				} elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
61 61
 					$datatype = 'Number';
62
-				}elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
62
+				} elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
63 63
 					$datatype = 'Object';
64
-				}else{
64
+				} else{
65 65
 					$datatype = 'String';
66 66
 				}
67 67
 				$default_value = Model_Data_Translator::prepare_field_value_for_json(
Please login to merge, or discard this patch.
core/services/container/CoffeeMaker.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 
71 71
     /**
72
-     * @param $type
72
+     * @param string $type
73 73
      */
74 74
     public static function validateType($type)
75 75
     {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * Examines the constructor to determine which method should be used for instantiation
127 127
      *
128 128
      * @param \ReflectionClass $reflector
129
-     * @return mixed
129
+     * @return string
130 130
      */
131 131
     protected function resolveInstantiationMethod(\ReflectionClass $reflector)
132 132
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
      */
57 57
     public static function getTypes()
58 58
     {
59
-        return (array)apply_filters(
59
+        return (array) apply_filters(
60 60
             'FHEE__EventEspresso\core\services\container\CoffeeMaker__getTypes',
61 61
             array(
62 62
                 CoffeeMaker::BREW_NEW,
Please login to merge, or discard this patch.
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\core\services\container\exceptions\InstantiationException;
7 7
 
8 8
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
-    exit('No direct script access allowed');
9
+	exit('No direct script access allowed');
10 10
 }
11 11
 
12 12
 
@@ -23,158 +23,158 @@  discard block
 block discarded – undo
23 23
 abstract class CoffeeMaker implements CoffeeMakerInterface
24 24
 {
25 25
 
26
-    /**
27
-     * Indicates that CoffeeMaker should construct a NEW entity instance from the provided arguments (if given)
28
-     */
29
-    const BREW_NEW = 'new';
30
-
31
-    /**
32
-     * Indicates that CoffeeMaker should always return a SHARED instance
33
-     */
34
-    const BREW_SHARED = 'shared';
35
-
36
-    /**
37
-     * Indicates that CoffeeMaker should only load the file/class/interface but NOT instantiate
38
-     */
39
-    const BREW_LOAD_ONLY = 'load_only';
40
-
41
-
42
-    /**
43
-     * @var CoffeePotInterface $coffee_pot
44
-     */
45
-    private $coffee_pot;
46
-
47
-    /**
48
-     * @var DependencyInjector $injector
49
-     */
50
-    private $injector;
51
-
52
-
53
-
54
-    /**
55
-     * @return array
56
-     */
57
-    public static function getTypes()
58
-    {
59
-        return (array)apply_filters(
60
-            'FHEE__EventEspresso\core\services\container\CoffeeMaker__getTypes',
61
-            array(
62
-                CoffeeMaker::BREW_NEW,
63
-                CoffeeMaker::BREW_SHARED,
64
-                CoffeeMaker::BREW_LOAD_ONLY,
65
-            )
66
-        );
67
-    }
68
-
69
-
70
-
71
-    /**
72
-     * @param $type
73
-     */
74
-    public static function validateType($type)
75
-    {
76
-        $types = CoffeeMaker::getTypes();
77
-        if ( ! in_array($type, $types)) {
78
-            throw new InvalidIdentifierException(
79
-                is_object($type) ? get_class($type) : gettype($type),
80
-                __(
81
-                    'recipe type (one of the class constants on \EventEspresso\core\services\container\CoffeeMaker)',
82
-                    'event_espresso'
83
-                )
84
-            );
85
-        }
86
-        return $type;
87
-    }
88
-
89
-
90
-
91
-    /**
92
-     * CoffeeMaker constructor.
93
-     *
94
-     * @param CoffeePotInterface $coffee_pot
95
-     * @param InjectorInterface  $injector
96
-     */
97
-    public function __construct(CoffeePotInterface $coffee_pot, InjectorInterface $injector)
98
-    {
99
-        $this->coffee_pot = $coffee_pot;
100
-        $this->injector = $injector;
101
-    }
102
-
103
-
104
-
105
-    /**
106
-     * @return \EventEspresso\core\services\container\CoffeePotInterface
107
-     */
108
-    protected function coffeePot()
109
-    {
110
-        return $this->coffee_pot;
111
-    }
112
-
113
-
114
-
115
-    /**
116
-     * @return \EventEspresso\core\services\container\DependencyInjector
117
-     */
118
-    protected function injector()
119
-    {
120
-        return $this->injector;
121
-    }
122
-
123
-
124
-
125
-    /**
126
-     * Examines the constructor to determine which method should be used for instantiation
127
-     *
128
-     * @param \ReflectionClass $reflector
129
-     * @return mixed
130
-     */
131
-    protected function resolveInstantiationMethod(\ReflectionClass $reflector)
132
-    {
133
-        if ($reflector->getConstructor() === null) {
134
-            return 'NewInstance';
135
-        } else if ($reflector->isInstantiable()) {
136
-            return 'NewInstanceArgs';
137
-        } else if (method_exists($reflector->getName(), 'instance')) {
138
-            return 'instance';
139
-        } else if (method_exists($reflector->getName(), 'new_instance')) {
140
-            return 'new_instance';
141
-        } else if (method_exists($reflector->getName(), 'new_instance_from_db')) {
142
-            return 'new_instance_from_db';
143
-        } else {
144
-            throw new InstantiationException($reflector->getName());
145
-        }
146
-    }
147
-
148
-
149
-
150
-    /**
151
-     * Ensures files for classes that are not PSR-4 compatible are loaded
152
-     * and then verifies that classes exist where applicable
153
-     *
154
-     * @param RecipeInterface $recipe
155
-     * @throws InvalidClassException
156
-     */
157
-    protected function resolveClassAndFilepath(RecipeInterface $recipe)
158
-    {
159
-        $paths = $recipe->paths();
160
-        if ( ! empty($paths)) {
161
-            foreach ($paths as $path) {
162
-                if (strpos($path, '*') === false && is_readable($path)) {
163
-                    require_once($path);
164
-                }
165
-            }
166
-        }
167
-        // re: using "false" for class_exists() second param:
168
-        // if a class name is not already known to PHP, then class_exists() will run through
169
-        // all of the registered spl_autoload functions until it either finds the class,
170
-        // or gets to the end of the registered spl_autoload functions.
171
-        // When the second parameter is true, it will also attempt to load the class file,
172
-        // but it will also trigger an error if the class can not be loaded.
173
-        // We don't want that extra error in the mix, so we have set the second param to "false"
174
-        if ($recipe->type() !== CoffeeMaker::BREW_LOAD_ONLY && ! class_exists($recipe->fqcn(), false)) {
175
-            throw new InvalidClassException($recipe->identifier());
176
-        }
177
-    }
26
+	/**
27
+	 * Indicates that CoffeeMaker should construct a NEW entity instance from the provided arguments (if given)
28
+	 */
29
+	const BREW_NEW = 'new';
30
+
31
+	/**
32
+	 * Indicates that CoffeeMaker should always return a SHARED instance
33
+	 */
34
+	const BREW_SHARED = 'shared';
35
+
36
+	/**
37
+	 * Indicates that CoffeeMaker should only load the file/class/interface but NOT instantiate
38
+	 */
39
+	const BREW_LOAD_ONLY = 'load_only';
40
+
41
+
42
+	/**
43
+	 * @var CoffeePotInterface $coffee_pot
44
+	 */
45
+	private $coffee_pot;
46
+
47
+	/**
48
+	 * @var DependencyInjector $injector
49
+	 */
50
+	private $injector;
51
+
52
+
53
+
54
+	/**
55
+	 * @return array
56
+	 */
57
+	public static function getTypes()
58
+	{
59
+		return (array)apply_filters(
60
+			'FHEE__EventEspresso\core\services\container\CoffeeMaker__getTypes',
61
+			array(
62
+				CoffeeMaker::BREW_NEW,
63
+				CoffeeMaker::BREW_SHARED,
64
+				CoffeeMaker::BREW_LOAD_ONLY,
65
+			)
66
+		);
67
+	}
68
+
69
+
70
+
71
+	/**
72
+	 * @param $type
73
+	 */
74
+	public static function validateType($type)
75
+	{
76
+		$types = CoffeeMaker::getTypes();
77
+		if ( ! in_array($type, $types)) {
78
+			throw new InvalidIdentifierException(
79
+				is_object($type) ? get_class($type) : gettype($type),
80
+				__(
81
+					'recipe type (one of the class constants on \EventEspresso\core\services\container\CoffeeMaker)',
82
+					'event_espresso'
83
+				)
84
+			);
85
+		}
86
+		return $type;
87
+	}
88
+
89
+
90
+
91
+	/**
92
+	 * CoffeeMaker constructor.
93
+	 *
94
+	 * @param CoffeePotInterface $coffee_pot
95
+	 * @param InjectorInterface  $injector
96
+	 */
97
+	public function __construct(CoffeePotInterface $coffee_pot, InjectorInterface $injector)
98
+	{
99
+		$this->coffee_pot = $coffee_pot;
100
+		$this->injector = $injector;
101
+	}
102
+
103
+
104
+
105
+	/**
106
+	 * @return \EventEspresso\core\services\container\CoffeePotInterface
107
+	 */
108
+	protected function coffeePot()
109
+	{
110
+		return $this->coffee_pot;
111
+	}
112
+
113
+
114
+
115
+	/**
116
+	 * @return \EventEspresso\core\services\container\DependencyInjector
117
+	 */
118
+	protected function injector()
119
+	{
120
+		return $this->injector;
121
+	}
122
+
123
+
124
+
125
+	/**
126
+	 * Examines the constructor to determine which method should be used for instantiation
127
+	 *
128
+	 * @param \ReflectionClass $reflector
129
+	 * @return mixed
130
+	 */
131
+	protected function resolveInstantiationMethod(\ReflectionClass $reflector)
132
+	{
133
+		if ($reflector->getConstructor() === null) {
134
+			return 'NewInstance';
135
+		} else if ($reflector->isInstantiable()) {
136
+			return 'NewInstanceArgs';
137
+		} else if (method_exists($reflector->getName(), 'instance')) {
138
+			return 'instance';
139
+		} else if (method_exists($reflector->getName(), 'new_instance')) {
140
+			return 'new_instance';
141
+		} else if (method_exists($reflector->getName(), 'new_instance_from_db')) {
142
+			return 'new_instance_from_db';
143
+		} else {
144
+			throw new InstantiationException($reflector->getName());
145
+		}
146
+	}
147
+
148
+
149
+
150
+	/**
151
+	 * Ensures files for classes that are not PSR-4 compatible are loaded
152
+	 * and then verifies that classes exist where applicable
153
+	 *
154
+	 * @param RecipeInterface $recipe
155
+	 * @throws InvalidClassException
156
+	 */
157
+	protected function resolveClassAndFilepath(RecipeInterface $recipe)
158
+	{
159
+		$paths = $recipe->paths();
160
+		if ( ! empty($paths)) {
161
+			foreach ($paths as $path) {
162
+				if (strpos($path, '*') === false && is_readable($path)) {
163
+					require_once($path);
164
+				}
165
+			}
166
+		}
167
+		// re: using "false" for class_exists() second param:
168
+		// if a class name is not already known to PHP, then class_exists() will run through
169
+		// all of the registered spl_autoload functions until it either finds the class,
170
+		// or gets to the end of the registered spl_autoload functions.
171
+		// When the second parameter is true, it will also attempt to load the class file,
172
+		// but it will also trigger an error if the class can not be loaded.
173
+		// We don't want that extra error in the mix, so we have set the second param to "false"
174
+		if ($recipe->type() !== CoffeeMaker::BREW_LOAD_ONLY && ! class_exists($recipe->fqcn(), false)) {
175
+			throw new InvalidClassException($recipe->identifier());
176
+		}
177
+	}
178 178
 
179 179
 
180 180
 
Please login to merge, or discard this patch.
core/services/collections/LooseCollection.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\collections;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -20,38 +20,38 @@  discard block
 block discarded – undo
20 20
 
21 21
 
22 22
 
23
-    /**
24
-     * setCollectionInterface
25
-     *
26
-     * @access protected
27
-     * @param  string $collection_interface
28
-     * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
29
-     */
30
-    protected function setCollectionInterface($collection_interface )
31
-    {
32
-        $this->collection_interface = '';
33
-    }
34
-
35
-
36
-
37
-    /**
38
-     * add
39
-     * attaches an object to the Collection
40
-     * and sets any supplied data associated with the current iterator entry
41
-     * by calling EE_Object_Collection::set_identifier()
42
-     *
43
-     * @access public
44
-     * @param  mixed $object
45
-     * @param  mixed $identifier
46
-     * @return bool
47
-     * @throws \EventEspresso\core\exceptions\InvalidEntityException
48
-     */
49
-    public function add($object, $identifier = null)
50
-    {
51
-        $this->attach($object);
52
-        $this->setIdentifier($object, $identifier);
53
-        return $this->contains($object);
54
-    }
23
+	/**
24
+	 * setCollectionInterface
25
+	 *
26
+	 * @access protected
27
+	 * @param  string $collection_interface
28
+	 * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
29
+	 */
30
+	protected function setCollectionInterface($collection_interface )
31
+	{
32
+		$this->collection_interface = '';
33
+	}
34
+
35
+
36
+
37
+	/**
38
+	 * add
39
+	 * attaches an object to the Collection
40
+	 * and sets any supplied data associated with the current iterator entry
41
+	 * by calling EE_Object_Collection::set_identifier()
42
+	 *
43
+	 * @access public
44
+	 * @param  mixed $object
45
+	 * @param  mixed $identifier
46
+	 * @return bool
47
+	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
48
+	 */
49
+	public function add($object, $identifier = null)
50
+	{
51
+		$this->attach($object);
52
+		$this->setIdentifier($object, $identifier);
53
+		return $this->contains($object);
54
+	}
55 55
 
56 56
 
57 57
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
      * @param  string $collection_interface
28 28
      * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
29 29
      */
30
-    protected function setCollectionInterface($collection_interface )
30
+    protected function setCollectionInterface($collection_interface)
31 31
     {
32 32
         $this->collection_interface = '';
33 33
     }
Please login to merge, or discard this patch.
core/services/container/ContainerInterface.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -18,26 +18,26 @@  discard block
 block discarded – undo
18 18
 interface ContainerInterface
19 19
 {
20 20
 
21
-    /**
22
-     * Finds an entry of the container by its identifier and returns it.
23
-     *
24
-     * @param string $id Identifier of the entry to look for.
25
-     * @return mixed Entry.
26
-     */
27
-    public function get($id);
28
-
29
-
30
-
31
-    /**
32
-     * Returns true if the container can return an entry for the given identifier.
33
-     * Returns false otherwise.
34
-     * `has($id)` returning true does not mean that `get($id)` will not throw an exception.
35
-     * It does however mean that `get($id)` will not throw a `NotFoundException`.
36
-     *
37
-     * @param string $id Identifier of the entry to look for.
38
-     * @return boolean
39
-     */
40
-    public function has($id);
21
+	/**
22
+	 * Finds an entry of the container by its identifier and returns it.
23
+	 *
24
+	 * @param string $id Identifier of the entry to look for.
25
+	 * @return mixed Entry.
26
+	 */
27
+	public function get($id);
28
+
29
+
30
+
31
+	/**
32
+	 * Returns true if the container can return an entry for the given identifier.
33
+	 * Returns false otherwise.
34
+	 * `has($id)` returning true does not mean that `get($id)` will not throw an exception.
35
+	 * It does however mean that `get($id)` will not throw a `NotFoundException`.
36
+	 *
37
+	 * @param string $id Identifier of the entry to look for.
38
+	 * @return boolean
39
+	 */
40
+	public function has($id);
41 41
 
42 42
 
43 43
 }
Please login to merge, or discard this patch.
core/services/container/CoffeeMakerInterface.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
 interface CoffeeMakerInterface
18 18
 {
19 19
 
20
-    /**
21
-     * @return array
22
-     */
23
-    public static function getTypes();
20
+	/**
21
+	 * @return array
22
+	 */
23
+	public static function getTypes();
24 24
 
25 25
 
26 26
 
27
-    /**
28
-     * @param $type
29
-     */
30
-    public static function validateType($type);
27
+	/**
28
+	 * @param $type
29
+	 */
30
+	public static function validateType($type);
31 31
 
32 32
 
33 33
 
34
-    /**
35
-     * @param RecipeInterface $recipe
36
-     * @param array           $arguments
37
-     * @return mixed
38
-     */
39
-    public function brew(RecipeInterface $recipe, $arguments = array());
34
+	/**
35
+	 * @param RecipeInterface $recipe
36
+	 * @param array           $arguments
37
+	 * @return mixed
38
+	 */
39
+	public function brew(RecipeInterface $recipe, $arguments = array());
40 40
 
41 41
 
42 42
 
43
-    /**
44
-     * @return string
45
-     */
46
-    public function type();
43
+	/**
44
+	 * @return string
45
+	 */
46
+	public function type();
47 47
 
48 48
 }
49 49
 // End of file CoffeeMakerInterface.php
Please login to merge, or discard this patch.
core/services/container/LoadOnlyCoffeeMaker.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -24,26 +24,26 @@  discard block
 block discarded – undo
24 24
 class LoadOnlyCoffeeMaker extends CoffeeMaker
25 25
 {
26 26
 
27
-    /**
28
-     * @return string
29
-     */
30
-    public function type()
31
-    {
32
-        return CoffeeMaker::BREW_LOAD_ONLY;
33
-    }
34
-
35
-
36
-
37
-    /**
38
-     * @param RecipeInterface $recipe
39
-     * @param array           $arguments
40
-     * @return mixed
41
-     */
42
-    public function brew(RecipeInterface $recipe, $arguments = array())
43
-    {
44
-        $this->resolveClassAndFilepath($recipe);
45
-        return null;
46
-    }
27
+	/**
28
+	 * @return string
29
+	 */
30
+	public function type()
31
+	{
32
+		return CoffeeMaker::BREW_LOAD_ONLY;
33
+	}
34
+
35
+
36
+
37
+	/**
38
+	 * @param RecipeInterface $recipe
39
+	 * @param array           $arguments
40
+	 * @return mixed
41
+	 */
42
+	public function brew(RecipeInterface $recipe, $arguments = array())
43
+	{
44
+		$this->resolveClassAndFilepath($recipe);
45
+		return null;
46
+	}
47 47
 
48 48
 
49 49
 
Please login to merge, or discard this patch.
core/services/container/exceptions/InstantiationException.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use BadMethodCallException;
5 5
 
6 6
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
-    exit('No direct script access allowed');
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
 class InstantiationException extends BadMethodCallException
21 21
 {
22 22
 
23
-    /**
24
-     * InstantiationException constructor.
25
-     *
26
-     * @param string $identifier the name of the requested entity or service
27
-     * @param string     $message
28
-     * @param int        $code
29
-     * @param \Exception $previous
30
-     */
31
-    public function __construct($identifier, $message = '', $code = 0, \Exception $previous = null)
32
-    {
33
-        if (empty($message)) {
34
-            $message = sprintf(
35
-                __(
36
-                    'The "%1$s" class could not be constructed.',
37
-                    'event_espresso'
38
-                ),
39
-                $identifier
40
-            );
41
-        }
42
-        parent::__construct($message, $code, $previous);
43
-    }
23
+	/**
24
+	 * InstantiationException constructor.
25
+	 *
26
+	 * @param string $identifier the name of the requested entity or service
27
+	 * @param string     $message
28
+	 * @param int        $code
29
+	 * @param \Exception $previous
30
+	 */
31
+	public function __construct($identifier, $message = '', $code = 0, \Exception $previous = null)
32
+	{
33
+		if (empty($message)) {
34
+			$message = sprintf(
35
+				__(
36
+					'The "%1$s" class could not be constructed.',
37
+					'event_espresso'
38
+				),
39
+				$identifier
40
+			);
41
+		}
42
+		parent::__construct($message, $code, $previous);
43
+	}
44 44
 
45 45
 }
46 46
 // End of file InstantiationException.php
Please login to merge, or discard this patch.