condition = $condition; $this->trueCase = $trueCase; $this->falseCase = $falseCase; } public function getCondition(): Condition { return $this->condition; } public function getTrueCase() { return $this->trueCase; } public function getFalseCase() { return $this->falseCase; } function getExpression(SQL $sql, array &$params): string { $condition = $sql->buildCondition($this->getCondition(), $params); // psql requires constant values here $trueCase = $sql->addValue($this->getTrueCase(), $params, true); $falseCase = $sql->addValue($this->getFalseCase(), $params, true); return "CASE WHEN $condition THEN $trueCase ELSE $falseCase END"; } }