Trigger_Conditions::find_value_in_number_cond( $value, $match_in, $recipes )
Contents
Parameters Parameters
- $value
-
(Required)
- $match_in
-
(Required)
- $recipes
-
(Required)
Return Return
(array) TODO: Write match condition vs number function here
Source Source
File: src/core/lib/recipe-parts/triggers/trait-trigger-conditions.php
protected function find_value_in_number_cond( $value, $match_in, $recipes ) { $matched = array(); // if ( empty( $recipes ) ) { // return $matched; // } // // Add where option is set to Any product. // foreach ( $recipes as $recipe_id => $recipe ) { // foreach ( $recipe['triggers'] as $trigger ) { // // Recipe ID does not exist in $match_in. // if ( ! isset( $match_in[ $recipe_id ] ) ) { // continue; // } // // $trigger_id = absint( $trigger['ID'] ); // // Trigger ID does not exist in $match_in. // if ( ! isset( $match_in[ $recipe_id ][ $trigger_id ] ) ) { // continue; // } // // // $value set is -1 (Any). // if ( true === $this->get_find_any() && intval( '-1' ) === intval( $match_in[ $recipe_id ][ $trigger_id ] ) ) { // $matched[ $recipe_id ] = $trigger_id; // } // // If value is not an array // if ( ! is_array( $value ) && (int) $value === (int) $match_in[ $recipe_id ][ $trigger_id ] ) { // $matched[ $recipe_id ] = $trigger_id; // } // // if value is of type array // if ( is_array( $value ) && in_array( (int) $match_in[ $recipe_id ][ $trigger_id ], array_map( 'absint', $value ), true ) ) { // $matched[ $recipe_id ] = $trigger_id; // } // } // } return $matched; }
Expand full source code Collapse full source code View on Github