cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,53 +1,60 @@
<?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\AMLI\FamilyMembersBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\MaritalStatus;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\PersonBundle\Entity\MaritalStatus;
use Chill\PersonBundle\Entity\Person;
use DateTime;
use DateTimeImmutable;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
*
* @ORM\MappedSuperclass()
* @author Julien Fastré <julien.fastre@champs-libres.coop>
* @ORM\MappedSuperclass
*/
abstract class AbstractFamilyMember implements HasCenterInterface
{
const FAMILIAL_SITUATION = [
'a_charge'=> 'A charge',
'garde_alternee'=> 'Garde alternée',
'droit_de_visite'=> 'Droit de visite et d\'hébergement',
'non_a_charge' => 'Non à charge',
];
public const FAMILIAL_SITUATION = [
'a_charge' => 'A charge',
'garde_alternee' => 'Garde alternée',
'droit_de_visite' => 'Droit de visite et d\'hébergement',
'non_a_charge' => 'Non à charge',
];
/**
*
* @var Person
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Person"
* )
*/
private $person;
/**
* @var date_immutable|null
*
* @var MaritalStatus
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\MaritalStatus"
* @ORM\Column(name="birthdate", type="date_immutable", nullable=true)
* @Assert\Date
*/
private $birthdate;
/**
* @var DateTimeImmutable|null
*
* @ORM\Column(name="endDate", type="datetime_immutable", nullable=true)
* @Assert\Date
* @Assert\GreaterThan(
* propertyPath="startDate",
* message="The membership's end date should be after the start date"
* )
*/
private $maritalStatus;
private $endDate;
/**
* @var string
*
* @ORM\Column(name="lastname", type="string", length=255)
* @ORM\Column(name="familial_situation", type="string", length=200, nullable=true)
*/
private $lastname = '';
private $familialSituation;
/**
* @var string
@@ -64,12 +71,34 @@ abstract class AbstractFamilyMember implements HasCenterInterface
private $gender = '';
/**
* @var date_immutable|null
* @var string
*
* @ORM\Column(name="birthdate", type="date_immutable", nullable=true)
* @Assert\Date()
* @ORM\Column(name="lastname", type="string", length=255)
*/
private $birthdate;
private $lastname = '';
/**
* @var string
*
* @ORM\Column(name="link", type="string", length=255)
*/
private $link = '';
/**
* @var MaritalStatus
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\MaritalStatus"
* )
*/
private $maritalStatus;
/**
* @var Person
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Person"
* )
*/
private $person;
/**
* @var string
@@ -79,57 +108,67 @@ abstract class AbstractFamilyMember implements HasCenterInterface
private $professionnalSituation = '';
/**
* @var string
*
* @ORM\Column(name="link", type="string", length=255)
*/
private $link = '';
/**
*
* @var string
* @ORM\Column(name="familial_situation", type="string", length=200, nullable=true)
*/
private $familialSituation;
/**
* @var \DateTimeImmutable
* @var DateTimeImmutable
*
* @ORM\Column(name="startDate", type="datetime_immutable")
* @Assert\NotNull()
* @Assert\Date()
* @Assert\NotNull
* @Assert\Date
*/
private $startDate;
/**
* @var \DateTimeImmutable|null
*
* @ORM\Column(name="endDate", type="datetime_immutable", nullable=true)
* @Assert\Date()
* @Assert\GreaterThan(
* propertyPath="startDate",
* message="The membership's end date should be after the start date"
* )
*/
private $endDate;
public function __construct()
{
$this->setStartDate(new \DateTimeImmutable('now'));
$this->setStartDate(new DateTimeImmutable('now'));
}
/**
* Set lastname.
*
* @param string $lastname
*
* @return FamilyMember
*/
public function setLastname($lastname)
{
$this->lastname = (string) $lastname;
return $this;
/**
* Get birthdate.
*
* @return date_immutable|null
*/
public function getBirthdate()
{
return $this->birthdate;
}
public function getCenter(): \Chill\MainBundle\Entity\Center
{
return $this->getPerson()->getCenter();
}
/**
* Get endDate.
*
* @return DateTimeImmutable|null
*/
public function getEndDate()
{
return $this->endDate;
}
public function getFamilialSituation()
{
return $this->familialSituation;
}
/**
* Get firstname.
*
* @return string
*/
public function getFirstname()
{
return $this->firstname;
}
/**
* Get gender.
*
* @return string
*/
public function getGender()
{
return $this->gender;
}
/**
@@ -142,6 +181,91 @@ abstract class AbstractFamilyMember implements HasCenterInterface
return $this->lastname;
}
/**
* Get link.
*
* @return string
*/
public function getLink()
{
return $this->link;
}
/**
* @return MaritalStatus
*/
public function getMaritalStatus()
{
return $this->maritalStatus;
}
/**
* @return Person
*/
public function getPerson()
{
return $this->person;
}
/**
* Get professionnalSituation.
*
* @return string
*/
public function getProfessionnalSituation()
{
return $this->professionnalSituation;
}
/**
* Get startDate.
*
* @return DateTimeImmutable
*/
public function getStartDate()
{
return $this->startDate;
}
/**
* Set birthdate.
*
* @return FamilyMember
*/
public function setBirthdate(?DateTimeInterface $birthdate = null)
{
if ($birthdate instanceof DateTime) {
$this->birthdate = DateTimeImmutable::createFromMutable($birthdate);
} elseif (null === $birthdate || $birthdate instanceof DateTimeImmutable) {
$this->birthdate = $birthdate;
}
return $this;
}
/**
* Set endDate.
*
* @return FamilyMember
*/
public function setEndDate(?DateTimeInterface $endDate = null)
{
if ($endDate instanceof DateTime) {
$this->endDate = DateTimeImmutable::createFromMutable($endDate);
} elseif ($endDate instanceof DateTimeImmutable || null === $endDate) {
$this->endDate = $endDate;
}
return $this;
}
public function setFamilialSituation($familialSituation)
{
$this->familialSituation = $familialSituation;
return $this;
}
/**
* Set firstname.
*
@@ -156,16 +280,6 @@ abstract class AbstractFamilyMember implements HasCenterInterface
return $this;
}
/**
* Get firstname.
*
* @return string
*/
public function getFirstname()
{
return $this->firstname;
}
/**
* Set gender.
*
@@ -181,67 +295,19 @@ abstract class AbstractFamilyMember implements HasCenterInterface
}
/**
* Get gender.
* Set lastname.
*
* @return string
*/
public function getGender()
{
return $this->gender;
}
/**
* Set birthdate.
*
* @param \DateTimeInterface|null $birthdate
* @param string $lastname
*
* @return FamilyMember
*/
public function setBirthdate(\DateTimeInterface $birthdate = null)
public function setLastname($lastname)
{
if ($birthdate instanceof \DateTime) {
$this->birthdate = \DateTimeImmutable::createFromMutable($birthdate);
} elseif ($birthdate === null || $birthdate instanceof \DateTimeImmutable) {
$this->birthdate = $birthdate;
}
$this->lastname = (string) $lastname;
return $this;
}
/**
* Get birthdate.
*
* @return date_immutable|null
*/
public function getBirthdate()
{
return $this->birthdate;
}
/**
* Set professionnalSituation.
*
* @param string $professionnalSituation
*
* @return FamilyMember
*/
public function setProfessionnalSituation($professionnalSituation)
{
$this->professionnalSituation = (string) $professionnalSituation;
return $this;
}
/**
* Get professionnalSituation.
*
* @return string
*/
public function getProfessionnalSituation()
{
return $this->professionnalSituation;
}
/**
* Set link.
*
@@ -257,127 +323,56 @@ abstract class AbstractFamilyMember implements HasCenterInterface
}
/**
* Get link.
* @param MaritalStatus $maritalStatus
*
* @return string
* @return $this
*/
public function getLink()
public function setMaritalStatus(?MaritalStatus $maritalStatus = null)
{
return $this->link;
}
public function getFamilialSituation()
{
return $this->familialSituation;
}
public function setFamilialSituation($familialSituation)
{
$this->familialSituation = $familialSituation;
return $this;
}
/**
* Set startDate.
*
* @param \DateTimeImmutable $startDate
*
* @return FamilyMember
*/
public function setStartDate(\DateTimeInterface $startDate)
{
if ($startDate instanceof \DateTime) {
$this->startDate = \DateTimeImmutable::createFromMutable($startDate);
} elseif (NULL === $startDate || $startDate instanceof \DateTimeImmutable) {
$this->startDate = $startDate;
}
$this->maritalStatus = $maritalStatus;
return $this;
}
/**
* Get startDate.
*
* @return \DateTimeImmutable
*/
public function getStartDate()
{
return $this->startDate;
}
/**
* Set endDate.
*
* @param \DateTimeInterface|null $endDate
*
* @return FamilyMember
*/
public function setEndDate(\DateTimeInterface $endDate = null)
{
if ($endDate instanceof \DateTime) {
$this->endDate = \DateTimeImmutable::createFromMutable($endDate);
} elseif ($endDate instanceof \DateTimeImmutable || $endDate === null) {
$this->endDate = $endDate;
}
return $this;
}
/**
* Get endDate.
*
* @return \DateTimeImmutable|null
*/
public function getEndDate()
{
return $this->endDate;
}
/**
*
* @return Person
*/
public function getPerson()
{
return $this->person;
}
/**
*
* @return MaritalStatus
*/
public function getMaritalStatus()
{
return $this->maritalStatus;
}
/**
*
* @param Person $person
* @return $this
*/
public function setPerson(Person $person)
{
$this->person = $person;
return $this;
}
/**
*
* @param MaritalStatus $maritalStatus
* @return $this
* Set professionnalSituation.
*
* @param string $professionnalSituation
*
* @return FamilyMember
*/
public function setMaritalStatus(MaritalStatus $maritalStatus = null)
public function setProfessionnalSituation($professionnalSituation)
{
$this->maritalStatus = $maritalStatus;
$this->professionnalSituation = (string) $professionnalSituation;
return $this;
}
public function getCenter(): \Chill\MainBundle\Entity\Center
/**
* Set startDate.
*
* @param DateTimeImmutable $startDate
*
* @return FamilyMember
*/
public function setStartDate(DateTimeInterface $startDate)
{
return $this->getPerson()->getCenter();
if ($startDate instanceof DateTime) {
$this->startDate = DateTimeImmutable::createFromMutable($startDate);
} elseif (null === $startDate || $startDate instanceof DateTimeImmutable) {
$this->startDate = $startDate;
}
return $this;
}
}

View File

@@ -1,11 +1,18 @@
<?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\AMLI\FamilyMembersBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* FamilyMember
* FamilyMember.
*
* @ORM\Table(name="chill_family.family_member")
* @ORM\Entity(repositoryClass="Chill\AMLI\FamilyMembersBundle\Repository\FamilyMemberRepository")