@@ -12,49 +12,49 @@ |
||
| 12 | 12 | class EventListIframeEmbedButton extends IframeEmbedButton |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * EventListIframeEmbedButton constructor. |
|
| 17 | - */ |
|
| 18 | - public function __construct() |
|
| 19 | - { |
|
| 20 | - parent::__construct( |
|
| 21 | - esc_html__('Upcoming Event List', 'event_espresso'), |
|
| 22 | - 'event_list' |
|
| 23 | - ); |
|
| 24 | - } |
|
| 15 | + /** |
|
| 16 | + * EventListIframeEmbedButton constructor. |
|
| 17 | + */ |
|
| 18 | + public function __construct() |
|
| 19 | + { |
|
| 20 | + parent::__construct( |
|
| 21 | + esc_html__('Upcoming Event List', 'event_espresso'), |
|
| 22 | + 'event_list' |
|
| 23 | + ); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | - public function addEmbedButton() |
|
| 28 | - { |
|
| 29 | - add_filter( |
|
| 30 | - 'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array', |
|
| 31 | - array($this, 'addEventListIframeEmbedButtonSection') |
|
| 32 | - ); |
|
| 33 | - add_action( |
|
| 34 | - 'admin_enqueue_scripts', |
|
| 35 | - array($this, 'embedButtonAssets'), |
|
| 36 | - 10 |
|
| 37 | - ); |
|
| 38 | - } |
|
| 27 | + public function addEmbedButton() |
|
| 28 | + { |
|
| 29 | + add_filter( |
|
| 30 | + 'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array', |
|
| 31 | + array($this, 'addEventListIframeEmbedButtonSection') |
|
| 32 | + ); |
|
| 33 | + add_action( |
|
| 34 | + 'admin_enqueue_scripts', |
|
| 35 | + array($this, 'embedButtonAssets'), |
|
| 36 | + 10 |
|
| 37 | + ); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Adds an iframe embed code button to the Event editor. |
|
| 43 | - * return string |
|
| 44 | - * |
|
| 45 | - * @param array $after_list_table |
|
| 46 | - * @return array |
|
| 47 | - */ |
|
| 48 | - public function addEventListIframeEmbedButtonSection(array $after_list_table) |
|
| 49 | - { |
|
| 50 | - return \EEH_Array::insert_into_array( |
|
| 51 | - $after_list_table, |
|
| 52 | - array( |
|
| 53 | - 'iframe_embed_buttons' => $this->addIframeEmbedButtonsSection( |
|
| 54 | - array('event_list' => $this->embedButtonHtml()) |
|
| 55 | - ), |
|
| 56 | - ), |
|
| 57 | - 'legend' |
|
| 58 | - ); |
|
| 59 | - } |
|
| 41 | + /** |
|
| 42 | + * Adds an iframe embed code button to the Event editor. |
|
| 43 | + * return string |
|
| 44 | + * |
|
| 45 | + * @param array $after_list_table |
|
| 46 | + * @return array |
|
| 47 | + */ |
|
| 48 | + public function addEventListIframeEmbedButtonSection(array $after_list_table) |
|
| 49 | + { |
|
| 50 | + return \EEH_Array::insert_into_array( |
|
| 51 | + $after_list_table, |
|
| 52 | + array( |
|
| 53 | + 'iframe_embed_buttons' => $this->addIframeEmbedButtonsSection( |
|
| 54 | + array('event_list' => $this->embedButtonHtml()) |
|
| 55 | + ), |
|
| 56 | + ), |
|
| 57 | + 'legend' |
|
| 58 | + ); |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -7,57 +7,57 @@ |
||
| 7 | 7 | class ChangesIn40833 extends ChangesInBase |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * Adds hooks so requests to 4.8.29 don't have the checkin endpoints |
|
| 12 | - */ |
|
| 13 | - public function setHooks() |
|
| 14 | - { |
|
| 15 | - // set a hook to remove the checkout/checkout endpoints if the request |
|
| 16 | - // is for lower than 4.8.33 |
|
| 17 | - add_filter( |
|
| 18 | - 'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes', |
|
| 19 | - array($this, 'removeCheckinRoutesEarlierThan4833'), |
|
| 20 | - 10, |
|
| 21 | - 2 |
|
| 22 | - ); |
|
| 23 | - add_filter( |
|
| 24 | - 'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_headers_from_ee_notices__return', |
|
| 25 | - array($this, 'dontAddHeadersFromEeNotices'), |
|
| 26 | - 10, |
|
| 27 | - 2 |
|
| 28 | - ); |
|
| 29 | - } |
|
| 10 | + /** |
|
| 11 | + * Adds hooks so requests to 4.8.29 don't have the checkin endpoints |
|
| 12 | + */ |
|
| 13 | + public function setHooks() |
|
| 14 | + { |
|
| 15 | + // set a hook to remove the checkout/checkout endpoints if the request |
|
| 16 | + // is for lower than 4.8.33 |
|
| 17 | + add_filter( |
|
| 18 | + 'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes', |
|
| 19 | + array($this, 'removeCheckinRoutesEarlierThan4833'), |
|
| 20 | + 10, |
|
| 21 | + 2 |
|
| 22 | + ); |
|
| 23 | + add_filter( |
|
| 24 | + 'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_headers_from_ee_notices__return', |
|
| 25 | + array($this, 'dontAddHeadersFromEeNotices'), |
|
| 26 | + 10, |
|
| 27 | + 2 |
|
| 28 | + ); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Removes the checkin and checkout endpoints from the index for requests |
|
| 34 | - * to api versions lowers than 4.8.33 |
|
| 35 | - * |
|
| 36 | - * @param array $routes_on_this_version |
|
| 37 | - * @param string $version |
|
| 38 | - * @return array like $routes_on_this_version |
|
| 39 | - */ |
|
| 40 | - public function removeCheckinRoutesEarlierThan4833($routes_on_this_version, $version) |
|
| 41 | - { |
|
| 42 | - if ($this->appliesToVersion($version)) { |
|
| 43 | - unset($routes_on_this_version['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)']); |
|
| 44 | - } |
|
| 45 | - return $routes_on_this_version; |
|
| 46 | - } |
|
| 32 | + /** |
|
| 33 | + * Removes the checkin and checkout endpoints from the index for requests |
|
| 34 | + * to api versions lowers than 4.8.33 |
|
| 35 | + * |
|
| 36 | + * @param array $routes_on_this_version |
|
| 37 | + * @param string $version |
|
| 38 | + * @return array like $routes_on_this_version |
|
| 39 | + */ |
|
| 40 | + public function removeCheckinRoutesEarlierThan4833($routes_on_this_version, $version) |
|
| 41 | + { |
|
| 42 | + if ($this->appliesToVersion($version)) { |
|
| 43 | + unset($routes_on_this_version['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)']); |
|
| 44 | + } |
|
| 45 | + return $routes_on_this_version; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * We just added headers for notices in this version |
|
| 51 | - * |
|
| 52 | - * @param array $headers_from_ee_notices |
|
| 53 | - * @param string $requested_version |
|
| 54 | - * @return array |
|
| 55 | - */ |
|
| 56 | - public function dontAddHeadersFromEeNotices($headers_from_ee_notices, $requested_version) |
|
| 57 | - { |
|
| 58 | - if ($this->appliesToVersion($requested_version)) { |
|
| 59 | - return array(); |
|
| 60 | - } |
|
| 61 | - return $headers_from_ee_notices; |
|
| 62 | - } |
|
| 49 | + /** |
|
| 50 | + * We just added headers for notices in this version |
|
| 51 | + * |
|
| 52 | + * @param array $headers_from_ee_notices |
|
| 53 | + * @param string $requested_version |
|
| 54 | + * @return array |
|
| 55 | + */ |
|
| 56 | + public function dontAddHeadersFromEeNotices($headers_from_ee_notices, $requested_version) |
|
| 57 | + { |
|
| 58 | + if ($this->appliesToVersion($requested_version)) { |
|
| 59 | + return array(); |
|
| 60 | + } |
|
| 61 | + return $headers_from_ee_notices; |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $force = false; |
| 57 | 57 | } |
| 58 | 58 | $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
| 59 | - if (! $reg instanceof EE_Registration) { |
|
| 59 | + if ( ! $reg instanceof EE_Registration) { |
|
| 60 | 60 | return $this->sendResponse( |
| 61 | 61 | new WP_Error( |
| 62 | 62 | 'rest_registration_toggle_checkin_invalid_id', |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | ) |
| 72 | 72 | ); |
| 73 | 73 | } |
| 74 | - if (! EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) { |
|
| 74 | + if ( ! EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) { |
|
| 75 | 75 | return $this->sendResponse( |
| 76 | 76 | new WP_Error( |
| 77 | 77 | 'rest_user_cannot_toggle_checkin', |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $success = $reg->toggle_checkin_status($dtt_id, ! $force); |
| 87 | 87 | if ($success === false) { |
| 88 | 88 | // check if we know they can't check in because they're not approved and we aren't forcing |
| 89 | - if (! $reg->is_approved() && ! $force) { |
|
| 89 | + if ( ! $reg->is_approved() && ! $force) { |
|
| 90 | 90 | // rely on EE_Error::add_error messages to have been added to give more data about why it failed |
| 91 | 91 | return $this->sendResponse( |
| 92 | 92 | new WP_Error( |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | ), |
| 119 | 119 | ) |
| 120 | 120 | ); |
| 121 | - if (! $checkin instanceof EE_Checkin) { |
|
| 121 | + if ( ! $checkin instanceof EE_Checkin) { |
|
| 122 | 122 | return $this->sendResponse( |
| 123 | 123 | new WP_Error( |
| 124 | 124 | 'rest_toggle_checkin_error', |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | $get_request = new WP_REST_Request( |
| 139 | 139 | 'GET', |
| 140 | - '/' . EED_Core_Rest_Api::ee_api_namespace . 'v' . $version . '/checkins/' . $checkin->ID() |
|
| 140 | + '/'.EED_Core_Rest_Api::ee_api_namespace.'v'.$version.'/checkins/'.$checkin->ID() |
|
| 141 | 141 | ); |
| 142 | 142 | $get_request->set_url_params( |
| 143 | 143 | array( |
@@ -26,124 +26,124 @@ |
||
| 26 | 26 | class Checkin extends Base |
| 27 | 27 | { |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @param WP_REST_Request $request |
|
| 31 | - * @param string $version |
|
| 32 | - * @return WP_Error|WP_REST_Response |
|
| 33 | - */ |
|
| 34 | - public static function handleRequestToggleCheckin(WP_REST_Request $request, $version) |
|
| 35 | - { |
|
| 36 | - $controller = new Checkin(); |
|
| 37 | - return $controller->createCheckinCheckoutObject($request, $version); |
|
| 38 | - } |
|
| 29 | + /** |
|
| 30 | + * @param WP_REST_Request $request |
|
| 31 | + * @param string $version |
|
| 32 | + * @return WP_Error|WP_REST_Response |
|
| 33 | + */ |
|
| 34 | + public static function handleRequestToggleCheckin(WP_REST_Request $request, $version) |
|
| 35 | + { |
|
| 36 | + $controller = new Checkin(); |
|
| 37 | + return $controller->createCheckinCheckoutObject($request, $version); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Toggles whether the user is checked in or not. |
|
| 43 | - * |
|
| 44 | - * @param WP_REST_Request $request |
|
| 45 | - * @param string $version |
|
| 46 | - * @return WP_Error|WP_REST_Response |
|
| 47 | - */ |
|
| 48 | - protected function createCheckinCheckoutObject(WP_REST_Request $request, $version) |
|
| 49 | - { |
|
| 50 | - $reg_id = $request->get_param('REG_ID'); |
|
| 51 | - $dtt_id = $request->get_param('DTT_ID'); |
|
| 52 | - $force = $request->get_param('force'); |
|
| 53 | - if ($force == 'true') { |
|
| 54 | - $force = true; |
|
| 55 | - } else { |
|
| 56 | - $force = false; |
|
| 57 | - } |
|
| 58 | - $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
|
| 59 | - if (! $reg instanceof EE_Registration) { |
|
| 60 | - return $this->sendResponse( |
|
| 61 | - new WP_Error( |
|
| 62 | - 'rest_registration_toggle_checkin_invalid_id', |
|
| 63 | - sprintf( |
|
| 64 | - esc_html__( |
|
| 65 | - 'You cannot checkin registration with ID %1$s because it doesn\'t exist.', |
|
| 66 | - 'event_espresso' |
|
| 67 | - ), |
|
| 68 | - $reg_id |
|
| 69 | - ), |
|
| 70 | - array('status' => 422) |
|
| 71 | - ) |
|
| 72 | - ); |
|
| 73 | - } |
|
| 74 | - if (! EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) { |
|
| 75 | - return $this->sendResponse( |
|
| 76 | - new WP_Error( |
|
| 77 | - 'rest_user_cannot_toggle_checkin', |
|
| 78 | - sprintf( |
|
| 79 | - esc_html__('You are not allowed to checkin registration with ID %1$s.', 'event_espresso'), |
|
| 80 | - $reg_id |
|
| 81 | - ), |
|
| 82 | - array('status' => 403) |
|
| 83 | - ) |
|
| 84 | - ); |
|
| 85 | - } |
|
| 86 | - $success = $reg->toggle_checkin_status($dtt_id, ! $force); |
|
| 87 | - if ($success === false) { |
|
| 88 | - // check if we know they can't check in because they're not approved and we aren't forcing |
|
| 89 | - if (! $reg->is_approved() && ! $force) { |
|
| 90 | - // rely on EE_Error::add_error messages to have been added to give more data about why it failed |
|
| 91 | - return $this->sendResponse( |
|
| 92 | - new WP_Error( |
|
| 93 | - 'rest_toggle_checkin_failed', |
|
| 94 | - esc_html__( |
|
| 95 | - // @codingStandardsIgnoreStart |
|
| 96 | - 'Registration check-in failed because the registration is not approved. You may attempt to force checking in though.', |
|
| 97 | - // @codingStandardsIgnoreEnd |
|
| 98 | - 'event_espresso' |
|
| 99 | - ) |
|
| 100 | - ) |
|
| 101 | - ); |
|
| 102 | - } |
|
| 103 | - return $this->sendResponse( |
|
| 104 | - new WP_Error( |
|
| 105 | - 'rest_toggle_checkin_failed_not_forceable', |
|
| 106 | - esc_html__('Registration checkin failed. Please see additional error data.', 'event_espresso') |
|
| 107 | - ) |
|
| 108 | - ); |
|
| 109 | - } |
|
| 110 | - $checkin = EEM_Checkin::instance()->get_one( |
|
| 111 | - array( |
|
| 112 | - array( |
|
| 113 | - 'REG_ID' => $reg_id, |
|
| 114 | - 'DTT_ID' => $dtt_id, |
|
| 115 | - ), |
|
| 116 | - 'order_by' => array( |
|
| 117 | - 'CHK_timestamp' => 'DESC', |
|
| 118 | - ), |
|
| 119 | - ) |
|
| 120 | - ); |
|
| 121 | - if (! $checkin instanceof EE_Checkin) { |
|
| 122 | - return $this->sendResponse( |
|
| 123 | - new WP_Error( |
|
| 124 | - 'rest_toggle_checkin_error', |
|
| 125 | - sprintf( |
|
| 126 | - esc_html__( |
|
| 127 | - // @codingStandardsIgnoreStart |
|
| 128 | - 'Supposedly we created a new checkin object for registration %1$s at datetime %2$s, but we can\'t find it.', |
|
| 129 | - // @codingStandardsIgnoreEnd |
|
| 130 | - 'event_espresso' |
|
| 131 | - ), |
|
| 132 | - $reg_id, |
|
| 133 | - $dtt_id |
|
| 134 | - ) |
|
| 135 | - ) |
|
| 136 | - ); |
|
| 137 | - } |
|
| 138 | - $get_request = new WP_REST_Request( |
|
| 139 | - 'GET', |
|
| 140 | - '/' . EED_Core_Rest_Api::ee_api_namespace . 'v' . $version . '/checkins/' . $checkin->ID() |
|
| 141 | - ); |
|
| 142 | - $get_request->set_url_params( |
|
| 143 | - array( |
|
| 144 | - 'id' => $checkin->ID(), |
|
| 145 | - ) |
|
| 146 | - ); |
|
| 147 | - return Read::handleRequestGetOne($get_request, $version, 'Checkin'); |
|
| 148 | - } |
|
| 41 | + /** |
|
| 42 | + * Toggles whether the user is checked in or not. |
|
| 43 | + * |
|
| 44 | + * @param WP_REST_Request $request |
|
| 45 | + * @param string $version |
|
| 46 | + * @return WP_Error|WP_REST_Response |
|
| 47 | + */ |
|
| 48 | + protected function createCheckinCheckoutObject(WP_REST_Request $request, $version) |
|
| 49 | + { |
|
| 50 | + $reg_id = $request->get_param('REG_ID'); |
|
| 51 | + $dtt_id = $request->get_param('DTT_ID'); |
|
| 52 | + $force = $request->get_param('force'); |
|
| 53 | + if ($force == 'true') { |
|
| 54 | + $force = true; |
|
| 55 | + } else { |
|
| 56 | + $force = false; |
|
| 57 | + } |
|
| 58 | + $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
|
| 59 | + if (! $reg instanceof EE_Registration) { |
|
| 60 | + return $this->sendResponse( |
|
| 61 | + new WP_Error( |
|
| 62 | + 'rest_registration_toggle_checkin_invalid_id', |
|
| 63 | + sprintf( |
|
| 64 | + esc_html__( |
|
| 65 | + 'You cannot checkin registration with ID %1$s because it doesn\'t exist.', |
|
| 66 | + 'event_espresso' |
|
| 67 | + ), |
|
| 68 | + $reg_id |
|
| 69 | + ), |
|
| 70 | + array('status' => 422) |
|
| 71 | + ) |
|
| 72 | + ); |
|
| 73 | + } |
|
| 74 | + if (! EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) { |
|
| 75 | + return $this->sendResponse( |
|
| 76 | + new WP_Error( |
|
| 77 | + 'rest_user_cannot_toggle_checkin', |
|
| 78 | + sprintf( |
|
| 79 | + esc_html__('You are not allowed to checkin registration with ID %1$s.', 'event_espresso'), |
|
| 80 | + $reg_id |
|
| 81 | + ), |
|
| 82 | + array('status' => 403) |
|
| 83 | + ) |
|
| 84 | + ); |
|
| 85 | + } |
|
| 86 | + $success = $reg->toggle_checkin_status($dtt_id, ! $force); |
|
| 87 | + if ($success === false) { |
|
| 88 | + // check if we know they can't check in because they're not approved and we aren't forcing |
|
| 89 | + if (! $reg->is_approved() && ! $force) { |
|
| 90 | + // rely on EE_Error::add_error messages to have been added to give more data about why it failed |
|
| 91 | + return $this->sendResponse( |
|
| 92 | + new WP_Error( |
|
| 93 | + 'rest_toggle_checkin_failed', |
|
| 94 | + esc_html__( |
|
| 95 | + // @codingStandardsIgnoreStart |
|
| 96 | + 'Registration check-in failed because the registration is not approved. You may attempt to force checking in though.', |
|
| 97 | + // @codingStandardsIgnoreEnd |
|
| 98 | + 'event_espresso' |
|
| 99 | + ) |
|
| 100 | + ) |
|
| 101 | + ); |
|
| 102 | + } |
|
| 103 | + return $this->sendResponse( |
|
| 104 | + new WP_Error( |
|
| 105 | + 'rest_toggle_checkin_failed_not_forceable', |
|
| 106 | + esc_html__('Registration checkin failed. Please see additional error data.', 'event_espresso') |
|
| 107 | + ) |
|
| 108 | + ); |
|
| 109 | + } |
|
| 110 | + $checkin = EEM_Checkin::instance()->get_one( |
|
| 111 | + array( |
|
| 112 | + array( |
|
| 113 | + 'REG_ID' => $reg_id, |
|
| 114 | + 'DTT_ID' => $dtt_id, |
|
| 115 | + ), |
|
| 116 | + 'order_by' => array( |
|
| 117 | + 'CHK_timestamp' => 'DESC', |
|
| 118 | + ), |
|
| 119 | + ) |
|
| 120 | + ); |
|
| 121 | + if (! $checkin instanceof EE_Checkin) { |
|
| 122 | + return $this->sendResponse( |
|
| 123 | + new WP_Error( |
|
| 124 | + 'rest_toggle_checkin_error', |
|
| 125 | + sprintf( |
|
| 126 | + esc_html__( |
|
| 127 | + // @codingStandardsIgnoreStart |
|
| 128 | + 'Supposedly we created a new checkin object for registration %1$s at datetime %2$s, but we can\'t find it.', |
|
| 129 | + // @codingStandardsIgnoreEnd |
|
| 130 | + 'event_espresso' |
|
| 131 | + ), |
|
| 132 | + $reg_id, |
|
| 133 | + $dtt_id |
|
| 134 | + ) |
|
| 135 | + ) |
|
| 136 | + ); |
|
| 137 | + } |
|
| 138 | + $get_request = new WP_REST_Request( |
|
| 139 | + 'GET', |
|
| 140 | + '/' . EED_Core_Rest_Api::ee_api_namespace . 'v' . $version . '/checkins/' . $checkin->ID() |
|
| 141 | + ); |
|
| 142 | + $get_request->set_url_params( |
|
| 143 | + array( |
|
| 144 | + 'id' => $checkin->ID(), |
|
| 145 | + ) |
|
| 146 | + ); |
|
| 147 | + return Read::handleRequestGetOne($get_request, $version, 'Checkin'); |
|
| 148 | + } |
|
| 149 | 149 | } |
@@ -13,5 +13,5 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | abstract class JobHandler implements JobHandlerInterface |
| 15 | 15 | { |
| 16 | - // so far no common methods or properties |
|
| 16 | + // so far no common methods or properties |
|
| 17 | 17 | } |
@@ -14,5 +14,5 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class BatchRequestException extends \Exception |
| 16 | 16 | { |
| 17 | - // so far the same as exception |
|
| 17 | + // so far the same as exception |
|
| 18 | 18 | } |
@@ -4,63 +4,63 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface HasSchemaInterface |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * Returns whatever is set as the nicename for the object. |
|
| 9 | - * |
|
| 10 | - * @return string |
|
| 11 | - */ |
|
| 12 | - public function getSchemaDescription(); |
|
| 7 | + /** |
|
| 8 | + * Returns whatever is set as the nicename for the object. |
|
| 9 | + * |
|
| 10 | + * @return string |
|
| 11 | + */ |
|
| 12 | + public function getSchemaDescription(); |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Returns whatever is set as the $_schema_type property for the object. |
|
| 17 | - * Note: this will automatically add 'null' to the schema if the object is_nullable() |
|
| 18 | - * |
|
| 19 | - * @return string|array |
|
| 20 | - */ |
|
| 21 | - public function getSchemaType(); |
|
| 15 | + /** |
|
| 16 | + * Returns whatever is set as the $_schema_type property for the object. |
|
| 17 | + * Note: this will automatically add 'null' to the schema if the object is_nullable() |
|
| 18 | + * |
|
| 19 | + * @return string|array |
|
| 20 | + */ |
|
| 21 | + public function getSchemaType(); |
|
| 22 | 22 | |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * This is usually present when the $_schema_type property is 'object'. Any child classes will need to override |
|
| 26 | - * this method and return the properties for the schema. |
|
| 27 | - * The reason this is not a property on the class is because there may be filters set on the values for the property |
|
| 28 | - * that won't be exposed on construct. For example enum type schemas may have the enum values filtered. |
|
| 29 | - * |
|
| 30 | - * @return array |
|
| 31 | - */ |
|
| 32 | - public function getSchemaProperties(); |
|
| 24 | + /** |
|
| 25 | + * This is usually present when the $_schema_type property is 'object'. Any child classes will need to override |
|
| 26 | + * this method and return the properties for the schema. |
|
| 27 | + * The reason this is not a property on the class is because there may be filters set on the values for the property |
|
| 28 | + * that won't be exposed on construct. For example enum type schemas may have the enum values filtered. |
|
| 29 | + * |
|
| 30 | + * @return array |
|
| 31 | + */ |
|
| 32 | + public function getSchemaProperties(); |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * If a child class has enum values, they should override this method and provide a simple array |
|
| 36 | - * of the enum values. |
|
| 37 | - * The reason this is not a property on the class is because there may be filterable enum values that |
|
| 38 | - * are set on the instantiated object that could be filtered after construct. |
|
| 39 | - * |
|
| 40 | - * @return array |
|
| 41 | - */ |
|
| 42 | - public function getSchemaEnum(); |
|
| 34 | + /** |
|
| 35 | + * If a child class has enum values, they should override this method and provide a simple array |
|
| 36 | + * of the enum values. |
|
| 37 | + * The reason this is not a property on the class is because there may be filterable enum values that |
|
| 38 | + * are set on the instantiated object that could be filtered after construct. |
|
| 39 | + * |
|
| 40 | + * @return array |
|
| 41 | + */ |
|
| 42 | + public function getSchemaEnum(); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * This returns the value of the $_schema_format property on the object. |
|
| 46 | - * |
|
| 47 | - * @return string |
|
| 48 | - */ |
|
| 49 | - public function getSchemaFormat(); |
|
| 44 | + /** |
|
| 45 | + * This returns the value of the $_schema_format property on the object. |
|
| 46 | + * |
|
| 47 | + * @return string |
|
| 48 | + */ |
|
| 49 | + public function getSchemaFormat(); |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * This returns the value of the $_schema_readonly property on the object. |
|
| 53 | - * |
|
| 54 | - * @return bool |
|
| 55 | - */ |
|
| 56 | - public function getSchemaReadonly(); |
|
| 51 | + /** |
|
| 52 | + * This returns the value of the $_schema_readonly property on the object. |
|
| 53 | + * |
|
| 54 | + * @return bool |
|
| 55 | + */ |
|
| 56 | + public function getSchemaReadonly(); |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * This returns elements used to represent this field in the json schema. |
|
| 61 | - * |
|
| 62 | - * @link http://json-schema.org/ |
|
| 63 | - * @return array |
|
| 64 | - */ |
|
| 65 | - public function getSchema(); |
|
| 59 | + /** |
|
| 60 | + * This returns elements used to represent this field in the json schema. |
|
| 61 | + * |
|
| 62 | + * @link http://json-schema.org/ |
|
| 63 | + * @return array |
|
| 64 | + */ |
|
| 65 | + public function getSchema(); |
|
| 66 | 66 | } |
@@ -12,9 +12,9 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | interface CaffeinatedInterface |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * Used to indicate when functionality is caffeinated or not. |
|
| 17 | - * @return bool |
|
| 18 | - */ |
|
| 19 | - public function isCaffeinated(); |
|
| 15 | + /** |
|
| 16 | + * Used to indicate when functionality is caffeinated or not. |
|
| 17 | + * @return bool |
|
| 18 | + */ |
|
| 19 | + public function isCaffeinated(); |
|
| 20 | 20 | } |
@@ -5,8 +5,8 @@ |
||
| 5 | 5 | interface SessionIdentifierInterface |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - /** |
|
| 9 | - * @return string |
|
| 10 | - */ |
|
| 11 | - public function id(); |
|
| 8 | + /** |
|
| 9 | + * @return string |
|
| 10 | + */ |
|
| 11 | + public function id(); |
|
| 12 | 12 | } |
@@ -16,45 +16,45 @@ |
||
| 16 | 16 | class CancelRegistrationService |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 21 | - */ |
|
| 22 | - private $cancel_ticket_line_item_service; |
|
| 23 | - |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Command constructor |
|
| 27 | - * |
|
| 28 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 29 | - */ |
|
| 30 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
| 31 | - { |
|
| 32 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @param \EE_Registration $registration |
|
| 38 | - * @param bool $cancel_ticket_line_item |
|
| 39 | - */ |
|
| 40 | - public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true) |
|
| 41 | - { |
|
| 42 | - // first cancel the original line item for the registration's ticket |
|
| 43 | - if ($cancel_ticket_line_item) { |
|
| 44 | - $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
| 45 | - } |
|
| 46 | - $this->cancelRegistrationOnly($registration); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @param \EE_Registration $registration |
|
| 52 | - * @throws \EE_Error |
|
| 53 | - */ |
|
| 54 | - public function cancelRegistrationOnly(\EE_Registration $registration) |
|
| 55 | - { |
|
| 56 | - // now cancel the registration itself |
|
| 57 | - $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
| 58 | - $registration->save(); |
|
| 59 | - } |
|
| 19 | + /** |
|
| 20 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 21 | + */ |
|
| 22 | + private $cancel_ticket_line_item_service; |
|
| 23 | + |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * Command constructor |
|
| 27 | + * |
|
| 28 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
| 29 | + */ |
|
| 30 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
| 31 | + { |
|
| 32 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @param \EE_Registration $registration |
|
| 38 | + * @param bool $cancel_ticket_line_item |
|
| 39 | + */ |
|
| 40 | + public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true) |
|
| 41 | + { |
|
| 42 | + // first cancel the original line item for the registration's ticket |
|
| 43 | + if ($cancel_ticket_line_item) { |
|
| 44 | + $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
| 45 | + } |
|
| 46 | + $this->cancelRegistrationOnly($registration); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @param \EE_Registration $registration |
|
| 52 | + * @throws \EE_Error |
|
| 53 | + */ |
|
| 54 | + public function cancelRegistrationOnly(\EE_Registration $registration) |
|
| 55 | + { |
|
| 56 | + // now cancel the registration itself |
|
| 57 | + $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
| 58 | + $registration->save(); |
|
| 59 | + } |
|
| 60 | 60 | } |