fix(continuous-integration): correction php-cs-fixer
All checks were successful
Cadoles/nineskeletor/pipeline/pr-master This commit looks good

This commit is contained in:
2022-09-23 16:14:15 +02:00
parent 5f3cc51f5c
commit b78f54b76c
70 changed files with 5943 additions and 5549 deletions

View File

@ -1,9 +1,10 @@
<?php
namespace App\Validator;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @Annotation
@ -14,12 +15,12 @@ class UserusernameValidator extends ConstraintValidator
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
$this->em = $em;
}
public function validate($value, Constraint $constraint)
{
if(!empty($value)) {
if (!empty($value)) {
// On s'assure que le login soit de 5 caractères minimum
if (strlen($value) < '5') {
$this->context->addViolation($constraint->messageinvalid);
@ -27,15 +28,15 @@ class UserusernameValidator extends ConstraintValidator
// On s'assure que le username ne contient pas des caractères speciaux
$string = preg_replace('~[^@a-zA-Z0-9._-]~', '', $value);
if($string!=$value)
if ($string != $value) {
$this->context->addViolation($constraint->messageinvalid);
}
// On s'assure que le username n'existe pas dans la table des registration
$registration = $this->em->getRepository("App\Entity\Registration")->findOneBy(["username"=>$value]);
if($registration) {
$registration = $this->em->getRepository("App\Entity\Registration")->findOneBy(['username' => $value]);
if ($registration) {
$this->context->addViolation($constraint->messagenotunique);
}
}
}
}
}
}