classUpsertOperator
final class UpsertOperator
What one operator stands for, once its operands have been worked out.
An expression is a tree, and walking it is one job; saying what a plus or a comparison means over two values it has already reached is another. This is the second, so that neither the walk nor any one operator has to know about the rest.
Type Aliases§
RowValue = import from TableDefinitionMethods§
public function __construct(
private UpsertNumber $numbers = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertNumber(),
private UpsertComparison $comparisons = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertComparison(),
private UpsertTruth $truth = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertTruth(),
)Parameters
$numbers | UpsertNumber | Does the arithmetic |
$comparisons | UpsertComparison | Does the comparing |
$truth | UpsertTruth | Answers what counts as true |
Test cases 3
Calls 3
- new UpsertNumber line 30
- new UpsertComparison line 31
- new UpsertTruth line 32
public function apply(
UpsertExpressionKind $kind,
mixed $left,
mixed $right,
): int|float|bool|nullAnswers what an operator stands for over the values it was written between.
Parameters
$kind | UpsertExpressionKind | Operator to apply |
$left | mixed | Value on its left, or its only value |
$right | mixed | Value on its right, and null where it has only one |
Returns
int|float|bool|null What the operator stands for, and null where it stands for nothing knowableThrows
InvalidDefinitionException When the kind names no operator at allUnsupportedSqlException When a value is not something the operator can be applied toTest cases 3
UpsertOperatorTest::testApplyAnswersWhatIsTrueOfEachLogicalOperatorcovers and callsUpsertOperatorTest::testApplyDoesTheArithmeticEachOperatorStandsForcovers and callsUpsertOperatorTest::testApplyDoesTheComparingEachOperatorStandsForcovers and calls
Called from 1
Calls 36
- class-const UpsertExpressionKind::Literal() line 54
- class-const UpsertExpressionKind::Column() line 55
- new InvalidDefinitionException line 55
- class-const UpsertExpressionKind::UnaryPlus() line 58
- method-call UpsertNumber::positive() line 58
- class-const UpsertExpressionKind::UnaryMinus() line 59
- method-call UpsertNumber::negative() line 59
- class-const UpsertExpressionKind::Not() line 60
- method-call UpsertTruth::not() line 60
- class-const UpsertExpressionKind::Add() line 61
- method-call UpsertNumber::add() line 61
- class-const UpsertExpressionKind::Subtract() line 62
- method-call UpsertNumber::subtract() line 62
- class-const UpsertExpressionKind::Multiply() line 63
- method-call UpsertNumber::multiply() line 63
- class-const UpsertExpressionKind::Divide() line 64
- method-call UpsertNumber::divide() line 64
- class-const UpsertExpressionKind::Modulo() line 65
- method-call UpsertNumber::modulo() line 65
- class-const UpsertExpressionKind::Equal() line 66
- method-call UpsertComparison::equal() line 66
- class-const UpsertExpressionKind::NotEqual() line 67
- method-call UpsertComparison::notEqual() line 67
- class-const UpsertExpressionKind::Less() line 68
- method-call UpsertComparison::less() line 68
- class-const UpsertExpressionKind::LessOrEqual() line 69
- method-call UpsertComparison::lessOrEqual() line 69
- class-const UpsertExpressionKind::Greater() line 70
- method-call UpsertComparison::greater() line 70
- class-const UpsertExpressionKind::GreaterOrEqual() line 71
- method-call UpsertComparison::greaterOrEqual() line 71
- class-const UpsertExpressionKind::And() line 72
- method-call UpsertTruth::and() line 72
- method-call UpsertTruth::of() line 72
- class-const UpsertExpressionKind::Or() line 73
- method-call UpsertTruth::or() line 73
Private surface 3§
Implementation details, listed for orientation only.
private UpsertNumber $numbers = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertNumber()private UpsertComparison $comparisons = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertComparison()private UpsertTruth $truth = new \ZtdQuery\Shadow\Mutation\Upsert\UpsertTruth()Test cases 9§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 3
UpsertOperatorTest::testApplyAnswersWhatIsTrueOfEachLogicalOperatorcovers and callsUpsertOperatorTest::testApplyDoesTheArithmeticEachOperatorStandsForcovers and callsUpsertOperatorTest::testApplyDoesTheComparingEachOperatorStandsForcovers and calls
Other tests reaching this symbol 6
ConflictSearchTestcallsMutationImpactTestcallsInsertMutationTestcallsUpsertExpressionTestcallsUpsertMutationTestcallsUpsertUpdateTestcalls