Skip to content

Commit

Permalink
Adds Validator::setValue and make Validator::getValue public (#6292)
Browse files Browse the repository at this point in the history
Co-authored-by: Deeka Wong <[email protected]>
Co-authored-by: Lu Fei <[email protected]>
  • Loading branch information
3 people authored Nov 16, 2023
1 parent 00c5173 commit 6cfed66
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,25 @@ public function setContainer(ContainerInterface $container)
$this->container = $container;
}

/**
* Get the value of a given attribute.
*/
public function getValue(string $attribute)
{
return Arr::get($this->data, $attribute);
}

/**
* Set the value of a given attribute.
*
* @param string $attribute
* @param mixed $value
*/
public function setValue($attribute, $value)
{
Arr::set($this->data, $attribute, $value);
}

/**
* Validate a given attribute against a rule.
*
Expand Down Expand Up @@ -967,14 +986,6 @@ protected function getRule(string $attribute, mixed $rules): ?array
return null;
}

/**
* Get the value of a given attribute.
*/
protected function getValue(string $attribute)
{
return Arr::get($this->data, $attribute);
}

/**
* Call a custom validator extension.
*/
Expand Down

0 comments on commit 6cfed66

Please sign in to comment.