fix(continuous-integration): correction php-cs-fixer
All checks were successful
Cadoles/nineskeletor/pipeline/pr-master This commit looks good
All checks were successful
Cadoles/nineskeletor/pipeline/pr-master This commit looks good
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Validator;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
@@ -8,5 +9,5 @@ use Symfony\Component\Validator\Constraint;
|
||||
*/
|
||||
class Grouplabel extends Constraint
|
||||
{
|
||||
public $message = "Caractères interdit dans ce label";
|
||||
}
|
||||
public $message = 'Caractères interdit dans ce label';
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Validator;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
@@ -21,9 +22,8 @@ class GrouplabelValidator extends ConstraintValidator
|
||||
|
||||
// On s'assure que le label 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->message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Validator;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
@@ -8,6 +9,6 @@ use Symfony\Component\Validator\Constraint;
|
||||
*/
|
||||
class Niveau01unique extends Constraint
|
||||
{
|
||||
public $messagegroup = "Un groupe utilise déjà ce label";
|
||||
public $messageniveau02 = "Un niveau de rang 02 utilise déjà ce label";
|
||||
}
|
||||
public $messagegroup = 'Un groupe utilise déjà ce label';
|
||||
public $messageniveau02 = 'Un niveau de rang 02 utilise déjà ce label';
|
||||
}
|
||||
|
@@ -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,19 +15,19 @@ class Niveau01uniqueValidator extends ConstraintValidator
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
$group = $this->em->getRepository("App\Entity\Group")->findOneBy(["label"=>$value]);
|
||||
if($group) {
|
||||
$group = $this->em->getRepository("App\Entity\Group")->findOneBy(['label' => $value]);
|
||||
if ($group) {
|
||||
$this->context->addViolation($constraint->messagegroup);
|
||||
}
|
||||
|
||||
$niveau02 = $this->em->getRepository("App\Entity\Niveau02")->findOneBy(["label"=>$value]);
|
||||
if($niveau02) {
|
||||
$niveau02 = $this->em->getRepository("App\Entity\Niveau02")->findOneBy(['label' => $value]);
|
||||
if ($niveau02) {
|
||||
$this->context->addViolation($constraint->messageniveau02);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Validator;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
@@ -8,6 +9,6 @@ use Symfony\Component\Validator\Constraint;
|
||||
*/
|
||||
class Niveau02unique extends Constraint
|
||||
{
|
||||
public $messagegroup = "Un groupe utilise déjà ce label";
|
||||
public $messageniveau01 = "Un niveau de rang 01 utilise déjà ce label";
|
||||
}
|
||||
public $messagegroup = 'Un groupe utilise déjà ce label';
|
||||
public $messageniveau01 = 'Un niveau de rang 01 utilise déjà ce label';
|
||||
}
|
||||
|
@@ -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,19 +15,19 @@ class Niveau02uniqueValidator extends ConstraintValidator
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
$group = $this->em->getRepository("App\Entity\Group")->findOneBy(["label"=>$value]);
|
||||
if($group) {
|
||||
$group = $this->em->getRepository("App\Entity\Group")->findOneBy(['label' => $value]);
|
||||
if ($group) {
|
||||
$this->context->addViolation($constraint->messagegroup);
|
||||
}
|
||||
|
||||
$niveau02 = $this->em->getRepository("App\Entity\Niveau01")->findOneBy(["label"=>$value]);
|
||||
if($niveau02) {
|
||||
$niveau02 = $this->em->getRepository("App\Entity\Niveau01")->findOneBy(['label' => $value]);
|
||||
if ($niveau02) {
|
||||
$this->context->addViolation($constraint->messageniveau01);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Validator;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
@@ -8,5 +9,5 @@ use Symfony\Component\Validator\Constraint;
|
||||
*/
|
||||
class Password extends Constraint
|
||||
{
|
||||
public $message = "Votre mot de passe doit contenir au minimum 8 caractères, constitué de chiffres, de lettres et caractères spéciaux";
|
||||
}
|
||||
public $message = 'Votre mot de passe doit contenir au minimum 8 caractères, constitué de chiffres, de lettres et caractères spéciaux';
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Validator;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
@@ -11,19 +12,16 @@ class PasswordValidator extends ConstraintValidator
|
||||
{
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if(!empty($value)) {
|
||||
if (!empty($value)) {
|
||||
if (strlen($value) < '8') {
|
||||
$this->context->addViolation($constraint->message);
|
||||
}
|
||||
elseif(!preg_match("#[0-9]+#",$value)) {
|
||||
} elseif (!preg_match('#[0-9]+#', $value)) {
|
||||
$this->context->addViolation($constraint->message);
|
||||
} elseif (!preg_match('#[a-zA-Z]+#', $value)) {
|
||||
$this->context->addViolation($constraint->message);
|
||||
} elseif (!preg_match("/[|!@#$%&*\/=?,;.:\-_+~^\\\]/", $value)) {
|
||||
$this->context->addViolation($constraint->message);
|
||||
}
|
||||
elseif(!preg_match("#[a-zA-Z]+#",$value)) {
|
||||
$this->context->addViolation($constraint->message);
|
||||
}
|
||||
elseif(!preg_match("/[|!@#$%&*\/=?,;.:\-_+~^\\\]/",$value)) {
|
||||
$this->context->addViolation($constraint->message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Validator;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
@@ -9,5 +10,5 @@ use Symfony\Component\Validator\Constraint;
|
||||
class Userusername extends Constraint
|
||||
{
|
||||
public $messageinvalid = "Le login n'est pas valide";
|
||||
public $messagenotunique = "Le login exisite déjà";
|
||||
}
|
||||
public $messagenotunique = 'Le login exisite déjà';
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user