From ef570fdf920afca7d8223f491a87827a86f90422 Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Tue, 21 Nov 2023 18:43:31 +0530 Subject: [PATCH] Add check for length in Queries Validator --- src/Database/Validator/Queries.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Database/Validator/Queries.php b/src/Database/Validator/Queries.php index c80a18366..f184b86bb 100644 --- a/src/Database/Validator/Queries.php +++ b/src/Database/Validator/Queries.php @@ -18,14 +18,20 @@ class Queries extends Validator */ protected array $validators; + /** + * @var int + */ + protected int $length; + /** * Queries constructor * * @param array $validators */ - public function __construct(array $validators = []) + public function __construct(array $validators = [], int $length = 0) { $this->validators = $validators; + $this->length = $length; } /** @@ -51,6 +57,10 @@ public function isValid($value): bool return false; } + if ($this->length && \count($value) > $this->length) { + return false; + } + foreach ($value as $query) { if (!$query instanceof Query) { try {