*/ protected array $wheres; /** * Constructor * * @param array $wheres Wheres. * @phpstan-ignore constructor.missingParentCall */ public function __construct( array $wheres ) { $this->wheres = $wheres; } /** * Get the WHEREs as a group * * @param string $logic Logic. * @return string */ protected function get_group( $logic ) { $start = ''; $end = ''; if ( count( $this->wheres ) > 1 ) { $start = '('; $end = ')'; } $sql = array_map( fn( $where ) => $where->get_as_sql(), $this->wheres ); return $start . implode( ' ' . $logic . ' ', $sql ) . $end; } public function get_as_sql() { return $this->get_group( 'OR' ); } public function update_column( $column, $updated_column ) { foreach ( $this->wheres as $where ) { $where->update_column( $column, $updated_column ); } } }