Skip to content

Commit

Permalink
PHPCS formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pattihis committed Jun 9, 2024
1 parent f4084b5 commit b59a60f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ public function swaggerize_args( array $args = [], array $defaults = [] ) {
}

$no_description = _x( 'No description provided', 'Default description for integration endpoint.', 'tribe-common' );
$defaults = array_merge(
$defaults = array_merge(
[
'in' => 'body',
'schema' => [
'type' => 'string',
'schema' => [
'type' => 'string',
],
'description' => $no_description,
'required' => false,
Expand All @@ -249,7 +249,6 @@ public function swaggerize_args( array $args = [], array $defaults = [] ) {
$defaults
);


$swaggerized = [];
foreach ( $args as $name => $info ) {
if ( isset( $info['swagger_type'] ) ) {
Expand All @@ -261,13 +260,13 @@ public function swaggerize_args( array $args = [], array $defaults = [] ) {
$type = $this->convert_type( $type );

$read = [
'name' => $name,
'in' => $info['in'] ?? false,
'description' => $info['description'] ?? false,
'schema' => [
'type' => $type,
'name' => $name,
'in' => $info['in'] ?? false,
'description' => $info['description'] ?? false,
'schema' => [
'type' => $type,
],
'required' => $info['required'] ?? false,
'required' => $info['required'] ?? false,
];

if ( isset( $info['items'] ) ) {
Expand All @@ -284,12 +283,12 @@ public function swaggerize_args( array $args = [], array $defaults = [] ) {
}

// Copy in case we need to mutate default values for this field in args
$defaultsCopy = $defaults;
unset( $defaultsCopy['default'] );
unset( $defaultsCopy['items'] );
unset( $defaultsCopy['type'] );
$defaults_copy = $defaults;
unset( $defaults_copy['default'] );
unset( $defaults_copy['items'] );
unset( $defaults_copy['type'] );

$swaggerized[] = array_merge( $defaultsCopy, array_filter( $read ) );
$swaggerized[] = array_merge( $defaults_copy, array_filter( $read ) );
}

return $swaggerized;
Expand Down Expand Up @@ -441,7 +440,7 @@ abstract protected function get_display_name(): string;
* @since TBD Migrated to Common from Event Automator
*/
public function add_to_dashboard() {
$api_id = $this->api::get_api_id();
$api_id = $this->api::get_api_id();

add_filter( "tec_event_automator_{$api_id}_endpoints", [ $this, 'add_endpoint_details' ], 10, 2 );
}
Expand Down Expand Up @@ -485,7 +484,7 @@ public function get_endpoint_details() {

// Setup queue counts only on that endpoint type.
if ( static::$type === 'queue' && isset( $this->trigger ) ) {
$endpoint_queue = (array) $this->trigger->get_queue();
$endpoint_queue = (array) $this->trigger->get_queue();
$endpoint['count'] = empty( $endpoint_queue ) ? 0 : count( $endpoint_queue );
}

Expand All @@ -512,7 +511,7 @@ public function get_saved_details() {
$this->get_option_id(),
[
'last_access' => '',
'enabled' => true,
'enabled' => true,
]
);
}
Expand Down Expand Up @@ -584,7 +583,7 @@ public function add_to_queue( $post_id, $data ) {
return;
}

$api_id = $this->api::get_api_id();
$api_id = $this->api::get_api_id();

/**
* Filters data passed to the trigger queue for an endpoint.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ class Action_Endpoints {
*
* @since TBD Migrated to Common from Event Automator
*
* @param array<string,array> $endpoint An array of the Zapier endpoint details.
* @param Abstract_REST_Endpoint $this An instance of the endpoint.
* @param array<string,array> $endpoint An array of the Zapier endpoint details.
* @param Abstract_REST_Endpoint $endpoint_obj An instance of the endpoint.
*/
public function filter_details( $endpoint, $endpoint_obj ) {
if ( in_array( $endpoint_obj->get_id(), [ 'new_events', 'updated_events', 'canceled_events', 'create_events' ], true ) ) {
if ( ! class_exists( 'Tribe__Events__REST__V1__Validator__Base', false ) ) {
// Disable if Tribe__Events__REST__V1__Validator__Base class does not exist.
$endpoint['missing_dependency'] = true;
$endpoint['dependents'] = [ 'tec' ];
$endpoint['dependents'] = [ 'tec' ];
}
} elseif ( in_array( $endpoint_obj->get_id(), [ 'attendees', 'updated_attendees', 'checkin', 'orders', 'refunded_orders' ], true ) ) {
if ( ! class_exists( 'Tribe__Tickets__REST__V1__Validator__Base', false ) ) {
// Disable if Tribe__Tickets__REST__V1__Validator__Base class does not exist.
$endpoint['missing_dependency'] = true;
$endpoint['dependents'] = [ 'et' ];
$endpoint['dependents'] = [ 'et' ];
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ class Action_Endpoints {
*
* @since TBD Migrated to Common from Event Automator
*
* @param array<string,array> $endpoint An array of the Zapier endpoint details.
* @param Abstract_REST_Endpoint $this An instance of the endpoint.
* @param array<string,array> $endpoint An array of the Zapier endpoint details.
* @param Abstract_REST_Endpoint $endpoint_obj An instance of the endpoint.
*/
public function filter_details( $endpoint, $endpoint_obj ) {
if ( in_array( $endpoint_obj->get_id(), [ 'new_events', 'updated_events', 'canceled_events', 'create_events' ], true ) ) {
if ( ! class_exists( 'Tribe__Events__REST__V1__Validator__Base', false ) ) {
// Disable if Tribe__Events__REST__V1__Validator__Base class does not exist.
$endpoint['missing_dependency'] = true;
$endpoint['dependents'] = [ 'tec' ];
$endpoint['dependents'] = [ 'tec' ];
}
} elseif ( in_array( $endpoint_obj->get_id(), [ 'attendees', 'updated_attendees', 'checkin', 'orders', 'refunded_orders' ], true ) ) {
if ( ! class_exists( 'Tribe__Tickets__REST__V1__Validator__Base', false ) ) {
// Disable if Tribe__Tickets__REST__V1__Validator__Base class does not exist.
$endpoint['missing_dependency'] = true;
$endpoint['dependents'] = [ 'et' ];
$endpoint['dependents'] = [ 'et' ];
}
}

Expand Down

0 comments on commit b59a60f

Please sign in to comment.