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,23 +1,21 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Validator;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use App\Validator as Validator;
use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @ORM\Entity
* @ORM\Table(name="useraccount")
* @ORM\HasLifecycleCallbacks()
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
*
*
* @UniqueEntity(fields="username", message="Un utilisateur existe déjà avec ce login.")
* @UniqueEntity(fields="email", message="Un utilisateur existe déjà avec ce mail.")
*/
@ -56,8 +54,8 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
*
* @ORM\Column(type="array", length=255)
*/
private $roles = array();
private $roles = [];
/**
* @ORM\Column(type="string", length=250)
*/
@ -79,7 +77,7 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
private $email;
/**
* @ORM\Column(type="string", length=250, nullable=true, options={"default" : 0})
* @ORM\Column(type="string", length=250, nullable=true, options={"default" : 0})
*/
private $avatar;
@ -87,12 +85,12 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
* @ORM\Column(type="boolean")
*/
protected $isvisible;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $postaladress;
/**
* @ORM\Column(type="string", length=60, nullable=true)
*/
@ -102,11 +100,11 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
* @ORM\Column(type="string", length=250, nullable=true)
*/
private $job;
/**
* @ORM\Column(type="string", length=250, nullable=true)
*/
private $position;
private $position;
/**
* @ORM\Column(type="text", nullable=true)
@ -126,13 +124,13 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $keyexpire;
private $keyexpire;
/**
* @ORM\Column(type="string", length=60, nullable=true)
*/
private $keyvalue;
private $keyvalue;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
@ -152,10 +150,10 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
/**
* @ORM\ManyToOne(targetEntity="Niveau02", inversedBy="users")
*/
private $niveau02;
private $niveau02;
/**
* @var ArrayCollection $groups
* @var ArrayCollection
* @var UserGroup
*
* @ORM\OneToMany(targetEntity="UserGroup", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
@ -163,7 +161,7 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
private $groups;
/**
* @var ArrayCollection $ownergroups
* @var ArrayCollection
* @var Group
*
* @ORM\OneToMany(targetEntity="Group", mappedBy="owner", cascade={"persist"}, orphanRemoval=false)
@ -171,7 +169,7 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
private $ownergroups;
/**
* @var ArrayCollection $groups
* @var ArrayCollection
* @var UserGroup
*
* @ORM\OneToMany(targetEntity="UserModo", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
@ -185,49 +183,48 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
$this->modos = new ArrayCollection();
}
//== CODE A NE PAS REGENERER
// == CODE A NE PAS REGENERER
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getUserIdentifier(): string
{
return $this->username;
}
public function setPasswordDirect($password)
{
// Permet de setter le password généré lors de l'inscription
$this->password = $password;
return $this;
}
}
/**
* @see PasswordAuthenticatedUserInterface
*/
public function getPassword(): string
{
return $this->password;
return $this->password;
}
public function setPassword($password): self
{
if($password!=$this->password&&$password!=""){
if ($password != $this->password && '' != $password) {
// Placer le password non encodé dans une variable tempo sur laquel on va appliquer la contraite de form
$this->passwordplain = $password;
// Password encrypté format openldap
// Password encrypté format openldap
$this->salt = uniqid(mt_rand(), true);
$hash = "{SSHA}" . base64_encode(pack("H*", sha1($password . $this->salt)) . $this->salt);
$hash = '{SSHA}'.base64_encode(pack('H*', sha1($password.$this->salt)).$this->salt);
$this->password = $hash;
$this->password = $hash;
}
return $this;
}
@ -257,22 +254,24 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
public function hasRole(string $role): ?bool
{
return in_array($role,$this->getRoles());
return in_array($role, $this->getRoles());
}
public function setRole(string $role): self
{
if(!$this->hasRole($role))
array_push($this->roles,$role);
if (!$this->hasRole($role)) {
array_push($this->roles, $role);
}
return $this;
}
public function getDisplayname() {
return $this->firstname." ".$this->lastname;
public function getDisplayname()
{
return $this->firstname.' '.$this->lastname;
}
//== FIN DU CODE A NE PAS REGENERER
// == FIN DU CODE A NE PAS REGENERER
public function getId(): ?int
{
@ -622,5 +621,4 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
return $this;
}
}