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,7 +1,16 @@
<?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\Entity\SocialWork;
use DateInterval;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@@ -11,14 +20,43 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
* @ORM\Table(name="chill_person_social_action")
* @Serializer\DiscriminatorMap(
* typeProperty="type",
* mapping={
* "social_work_social_action":SocialAction::class
* }
* )
* typeProperty="type",
* mapping={
* "social_work_social_action": SocialAction::class
* }
* )
*/
class SocialAction
{
/**
* @ORM\OneToMany(targetEntity=SocialAction::class, mappedBy="parent")
*/
private $children;
/**
* @ORM\Column(type="dateinterval", nullable=true)
*/
private $defaultNotificationDelay;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $desactivationDate;
/**
* @ORM\OneToMany(
* targetEntity=Evaluation::class,
* mappedBy="socialAction"
* )
*/
private Collection $evaluations;
/**
* @ORM\ManyToMany(targetEntity=Goal::class, inversedBy="socialActions")
* @ORM\JoinTable(name="chill_person_social_action_goal")
*/
private $goals;
/**
* @ORM\Id
* @ORM\GeneratedValue
@@ -26,11 +64,6 @@ class SocialAction
*/
private $id;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $desactivationDate;
/**
* @ORM\ManyToOne(targetEntity=SocialIssue::class, inversedBy="socialActions")
*/
@@ -41,27 +74,6 @@ class SocialAction
*/
private $parent;
/**
* @ORM\OneToMany(targetEntity=SocialAction::class, mappedBy="parent")
*/
private $children;
/**
* @ORM\Column(type="dateinterval", nullable=true)
*/
private $defaultNotificationDelay;
/**
* @ORM\Column(type="json")
*/
private $title = [];
/**
* @ORM\ManyToMany(targetEntity=Goal::class, inversedBy="socialActions")
* @ORM\JoinTable(name="chill_person_social_action_goal")
*/
private $goals;
/**
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="socialActions")
* @ORM\JoinTable(name="chill_person_social_action_result")
@@ -69,13 +81,9 @@ class SocialAction
private $results;
/**
* @var Collection
* @ORM\OneToMany(
* targetEntity=Evaluation::class,
* mappedBy="socialAction"
* )
* @ORM\Column(type="json")
*/
private Collection $evaluations;
private $title = [];
public function __construct()
{
@@ -84,60 +92,6 @@ class SocialAction
$this->results = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDesactivationDate(): ?\DateTimeInterface
{
return $this->desactivationDate;
}
public function setDesactivationDate(?\DateTimeInterface $desactivationDate): self
{
$this->desactivationDate = $desactivationDate;
return $this;
}
public function getIssue(): ?SocialIssue
{
return $this->issue;
}
public function setIssue(?SocialIssue $issue): self
{
$this->issue = $issue;
return $this;
}
public function getParent(): ?self
{
return $this->parent;
}
public function hasParent(): bool
{
return $this->getParent() instanceof self;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
return $this;
}
/**
* @return Collection|self[]
*/
public function getChildren(): Collection
{
return $this->children;
}
public function addChild(self $child): self
{
if (!$this->children->contains($child)) {
@@ -148,18 +102,42 @@ class SocialAction
return $this;
}
public function removeChild(self $child): self
public function addGoal(Goal $goal): self
{
if ($this->children->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getParent() === $this) {
$child->setParent(null);
}
if (!$this->goals->contains($goal)) {
$this->goals[] = $goal;
}
return $this;
}
public function addResult(Result $result): self
{
if (!$this->results->contains($result)) {
$this->results[] = $result;
}
return $this;
}
/**
* @return Collection|self[]
*/
public function getChildren(): Collection
{
return $this->children;
}
public function getDefaultNotificationDelay(): ?DateInterval
{
return $this->defaultNotificationDelay;
}
public function getDesactivationDate(): ?DateTimeInterface
{
return $this->desactivationDate;
}
/**
* @return Collection|self[] All the descendants (children, children of children, ...)
*/
@@ -168,10 +146,11 @@ class SocialAction
$descendants = new ArrayCollection();
foreach ($this->getChildren() as $child) {
if(! $descendants->contains($child)) {
if (!$descendants->contains($child)) {
$descendants->add($child);
foreach($child->getDescendants() as $descendantsOfChild) {
if(! $descendants->contains($descendantsOfChild)) {
foreach ($child->getDescendants() as $descendantsOfChild) {
if (!$descendants->contains($descendantsOfChild)) {
$descendants->add($descendantsOfChild);
}
}
@@ -188,35 +167,16 @@ class SocialAction
{
$descendants = $this->getDescendants();
if(! $descendants->contains($this)) {
if (!$descendants->contains($this)) {
$descendants->add($this);
}
return $descendants;
}
public function getDefaultNotificationDelay(): ?\DateInterval
public function getEvaluations(): Collection
{
return $this->defaultNotificationDelay;
}
public function setDefaultNotificationDelay(\DateInterval $defaultNotificationDelay): self
{
$this->defaultNotificationDelay = $defaultNotificationDelay;
return $this;
}
public function getTitle(): array
{
return $this->title;
}
public function setTitle(array $title): self
{
$this->title = $title;
return $this;
return $this->evaluations;
}
/**
@@ -227,10 +187,46 @@ class SocialAction
return $this->goals;
}
public function addGoal(Goal $goal): self
public function getId(): ?int
{
if (!$this->goals->contains($goal)) {
$this->goals[] = $goal;
return $this->id;
}
public function getIssue(): ?SocialIssue
{
return $this->issue;
}
public function getParent(): ?self
{
return $this->parent;
}
/**
* @return Collection|Result[]
*/
public function getResults(): Collection
{
return $this->results;
}
public function getTitle(): array
{
return $this->title;
}
public function hasParent(): bool
{
return $this->getParent() instanceof self;
}
public function removeChild(self $child): self
{
if ($this->children->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getParent() === $this) {
$child->setParent(null);
}
}
return $this;
@@ -243,23 +239,6 @@ class SocialAction
return $this;
}
/**
* @return Collection|Result[]
*/
public function getResults(): Collection
{
return $this->results;
}
public function addResult(Result $result): self
{
if (!$this->results->contains($result)) {
$this->results[] = $result;
}
return $this;
}
public function removeResult(Result $result): self
{
$this->results->removeElement($result);
@@ -267,11 +246,38 @@ class SocialAction
return $this;
}
/**
* @return Collection
*/
public function getEvaluations(): Collection
public function setDefaultNotificationDelay(DateInterval $defaultNotificationDelay): self
{
return $this->evaluations;
$this->defaultNotificationDelay = $defaultNotificationDelay;
return $this;
}
public function setDesactivationDate(?DateTimeInterface $desactivationDate): self
{
$this->desactivationDate = $desactivationDate;
return $this;
}
public function setIssue(?SocialIssue $issue): self
{
$this->issue = $issue;
return $this;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
return $this;
}
public function setTitle(array $title): self
{
$this->title = $title;
return $this;
}
}