protected function applyValue($input, Context $ctx) { $valid = false; foreach ($this->checks as $id => $check) { $newCtx = new Context(); $input = $check->apply($input, $newCtx); $flat = $newCtx->flatten(); if ($flat->valid) { $valid = $flat->valid; if ($change = $flat->change) { $ctx->setChange($change); } if (!$flat->complete) { $ctx->setIncomplete($this); } break; } } if (!$valid) { $ctx->addReason($this, ['id' => 'any.invalid']); } return $input; }
function apply($input, Context $ctx) { $ctx->setIncomplete($this); return $input; }
function validate(array $input, Context $ctx) { $ctx->setIncomplete($this); }
private function compareString(Context $ctx, $left, $right) { if (is_string($left) && is_string($right)) { if (static::$intlAvailable) { if ($this->test(\Normalizer::normalize($left) != \Normalizer::normalize($right))) { $ctx->addReason($this, ['id' => 'equal.stringNotEqual', 'params' => $properties]); } } else { $ctx->setIncomplete($this); } } else { $ctx->addReason($this, ['id' => 'equal.incomparable', 'params' => ['leftProp' => $this->left, 'rightProp' => $this->right]]); } return; }