Skip to content

Commit

Permalink
Fix PHPCS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JPry committed Jan 10, 2025
1 parent 6a3cf22 commit 65c5bd6
Showing 1 changed file with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function find_by_id( int $id ): Order_Modifier {
*/
public function search_modifiers( array $args = [] ): array {
// Merge passed arguments with defaults.
$args = wp_parse_args( $args, $this->get_default_query_params() );
$args = wp_parse_args( $args, $this->get_default_query_params() );
$valid_args = $this->get_valid_params( $args );

// Start building the query.
Expand Down Expand Up @@ -243,7 +243,7 @@ public function search_modifiers( array $args = [] ): array {
*/
public function get_search_count( array $args = [] ): int {
// Merge passed arguments with defaults.
$args = wp_parse_args( $args, $this->get_default_query_params() );
$args = wp_parse_args( $args, $this->get_default_query_params() );
$valid_args = $this->get_valid_params( $args );

// Start building the query.
Expand Down Expand Up @@ -413,8 +413,7 @@ public function find_by_modifier_type_and_meta(
$meta
)
->where( "{$modifiers}.modifier_type", $this->modifier_type )
->where( "{$modifiers}.status", 'active' )
;
->where( "{$modifiers}.status", 'active' );

// Handle the meta_key condition: Use IFNULL if a default_meta_key is provided, otherwise check for meta_key directly.
if ( $default_meta_key ) {
Expand Down Expand Up @@ -454,7 +453,7 @@ public function find_by_modifier_type_and_meta(
* @since TBD
*
* @param string[] $applied_to The value(s) to filter the query by.
* @param array $params { Optional. Parameters to filter the query.
* @param array $params { Optional. Parameters to filter the query.
* @type string[] $status The status of the modifiers to filter by. Default 'active'.
* @type int $limit The number of results to return. Default 10.
* @type string $order The order of the results. Default 'DESC'.
Expand All @@ -474,14 +473,14 @@ public function get_modifier_by_applied_to( array $applied_to, array $params = [

// Generate a cache key based on the arguments.
$cache_key = 'modifier_type_applied_to_' . md5(
wp_json_encode(
[
$this->modifier_type,
$applied_to,
$valid_params,
]
)
);
wp_json_encode(
[
$this->modifier_type,
$applied_to,
$valid_params,
]
)
);

$tribe_cache = tribe( 'cache' );

Expand All @@ -498,7 +497,7 @@ public function get_modifier_by_applied_to( array $applied_to, array $params = [
// Initialize the query builder and construct the query.
$builder = new QueryBuilder();
$builder
->from( $this->get_table_name( false ), $modifiers)
->from( $this->get_table_name( false ), $modifiers )
->select( "{$modifiers}.*", "{$meta}.meta_value" )
->innerJoin(
$this->get_meta_table_name( false ),
Expand All @@ -508,8 +507,7 @@ public function get_modifier_by_applied_to( array $applied_to, array $params = [
)
->where( "{$modifiers}.modifier_type", $this->modifier_type )
->where( "{$meta}.meta_key", $this->get_applied_to_key() )
->whereIn( "{$meta}.meta_value", $applied_to )
;
->whereIn( "{$meta}.meta_value", $applied_to );

// Add the status params to the pieces.
if ( array_key_exists( 'status', $valid_params ) ) {
Expand Down Expand Up @@ -637,7 +635,7 @@ protected function get_valid_params( array $params ): array {
break;

case 'order':
$value = strtoupper( $value );
$value = strtoupper( $value );
$valid_params[ $key ] = 'ASC' === $value ? 'ASC' : 'DESC';
break;

Expand Down

0 comments on commit 65c5bd6

Please sign in to comment.