mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Validator\Constraints\Household;
|
||||
|
||||
use Chill\MainBundle\Util\DateRangeCovering;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedValueException;
|
||||
|
||||
class MaxHolderValidator extends ConstraintValidator
|
||||
{
|
||||
@@ -20,8 +25,10 @@ class MaxHolderValidator extends ConstraintValidator
|
||||
return;
|
||||
}
|
||||
|
||||
$covers = new DateRangeCovering(self::MAX_HOLDERS,
|
||||
$holders[0]->getStartDate()->getTimezone());
|
||||
$covers = new DateRangeCovering(
|
||||
self::MAX_HOLDERS,
|
||||
$holders[0]->getStartDate()->getTimezone()
|
||||
);
|
||||
|
||||
foreach ($holders as $key => $member) {
|
||||
$covers->add($member->getStartDate(), $member->getEndDate(), $key);
|
||||
@@ -30,18 +37,17 @@ class MaxHolderValidator extends ConstraintValidator
|
||||
$covers->compute();
|
||||
|
||||
if ($covers->hasIntersections()) {
|
||||
foreach ($covers->getIntersections() as list($start, $end, $ids)) {
|
||||
$msg = $end === null ? $constraint->messageInfinity :
|
||||
foreach ($covers->getIntersections() as [$start, $end, $ids]) {
|
||||
$msg = null === $end ? $constraint->messageInfinity :
|
||||
$constraint->message;
|
||||
|
||||
$this->context->buildViolation($msg)
|
||||
->setParameters([
|
||||
'{{ start }}' => $start->format('d-m-Y'), // TODO fix when MessageParameter works with timezone
|
||||
'{{ end }}' => $end === null ? null : $end->format('d-m-Y')
|
||||
'{{ end }}' => null === $end ? null : $end->format('d-m-Y'),
|
||||
])
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user