on = []; return $this; } /** * Add a ON condition. * @param string|callable $column The column of the condition, or a condition builder callable. * @param string $operator The operator of the condition (or the value column if no value is passed). * @param string|null $valueColumn The value column of the condition. * @return mixed The query. */ public function on(string|callable $column, string $operator, string $valueColumn = null): mixed { if (is_callable($column)) { // Callable condition builder. $this->on[] = $column(new ConditionBuilder()); } else { // Simple condition, registering it. if (!empty($operator) && empty($valueColumn)) { // If there are 2 parameters, considering the second one as the value, with default operator. $valueColumn = $operator; // Default operator: "=". $operator = "="; } // Create the simple condition. $this->on[] = (new ConditionBuilder())->column($column)->operator($operator)->column($valueColumn); } return $this->query; } /** * Get join conditions. * @return ConditionBuilder[] ON conditions of the JOIN clause. */ public function getConditions(): array { return $this->on; } }