Skip to content

Commit

Permalink
requiring libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimz22 committed Oct 4, 2021
1 parent c7bb1a9 commit f1450e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vertigolabs/validation-aware",
"description": "validation aware traits",
"version": "1.0.2",
"version": "1.0.3",
"minimum-stability": "stable",
"license": "MIT",
"authors": [
Expand All @@ -12,7 +12,9 @@
],
"require": {
"php": ">=8.0.0",
"symfony/validator": "5.3.8"
"symfony/validator": "5.3.8",
"vertigolabs/data-aware": "1.0.0",
"vertigolabs/logger-aware": "1.0.3"
}
,
"require-dev": {
Expand Down
10 changes: 6 additions & 4 deletions src/ValidationAware.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\Validation;
use VertigoLabs\DataAware\DataAware;
use VertigoLabs\LoggerAware\LoggerAware;

trait ValidationAware
{
use LoggerAware;
use DataAware;

/**
* @var bool The current validity status
*/
protected bool $valid = false;

abstract protected function log(string $message, ?int $level = null, string|array|null $channel = null): void;

abstract public function getData(string|array $key = null, mixed $default = null): mixed;

/**
* Returns a collection of validation constraints
*
Expand All @@ -47,6 +48,7 @@ public function isValid(): bool
* Validates input data.
*
* @return ConstraintViolationList
* @throws \VertigoLabs\DataAware\Exceptions\DataNotFoundNoDefaultException
*/
final public function validate(): ConstraintViolationList
{
Expand Down

0 comments on commit f1450e0

Please sign in to comment.