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,36 +1,54 @@
<?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\TaskBundle\Entity;
use DateInterval;
use DateTime;
use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\Collection;
/**
* SingleTask
* SingleTask.
*
* @ORM\Table(
* name="chill_task.single_task",
* indexes={
* @ORM\Index(
* name="by_type",
* columns={ "type" }
* ),
* @ORM\Index(
* name="by_current_state",
* columns={ "current_states" }
* ),
* @ORM\Index(
* name="by_end_date",
* columns={ "end_date" }
* )
* }
* name="chill_task.single_task",
* indexes={
* @ORM\Index(
* name="by_type",
* columns={ "type" }
* ),
* @ORM\Index(
* name="by_current_state",
* columns={ "current_states" }
* ),
* @ORM\Index(
* name="by_end_date",
* columns={ "end_date" }
* )
* }
* )
* @ORM\Entity(repositoryClass="Chill\TaskBundle\Repository\SingleTaskRepository")
*/
class SingleTask extends AbstractTask
{
/**
* @var DateTime
*
* @ORM\Column(name="end_date", type="date", nullable=true)
* @Assert\Date
*/
private $endDate;
/**
* @var int
*
@@ -41,75 +59,72 @@ class SingleTask extends AbstractTask
private $id;
/**
* @var \DateTime
*
* @ORM\Column(name="start_date", type="date", nullable=true)
* @Assert\Date()
*
* @Assert\Expression(
* "value === null or this.getEndDate() === null or value < this.getEndDate()",
* message="The start date must be before the end date"
* )
*
* @Assert\Expression(
* "value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()",
* message="The start date must be before warning date"
* )
*/
private $startDate;
/**
* @var \DateTime
*
* @ORM\Column(name="end_date", type="date", nullable=true)
* @Assert\Date()
*/
private $endDate;
/**
* @var \DateInterval
* and this.getEndDate() === null
*
* @ORM\Column(name="warning_interval", type="dateinterval", nullable=true)
*
* @Assert\Expression(
* "!(value != null and this.getEndDate() == null)",
* message="An end date is required if a warning interval is set"
* )
*
*
*/
private $warningInterval;
/**
*
* @var RecurringTask
* @ORM\ManyToOne(
* targetEntity="RecurringTask",
* inversedBy="singleTasks"
* targetEntity="RecurringTask",
* inversedBy="singleTasks"
* )
*/
private $recurringTask;
/**
* @var DateTime
*
* @ORM\Column(name="start_date", type="date", nullable=true)
* @Assert\Date
*
* @Assert\Expression(
* "value === null or this.getEndDate() === null or value < this.getEndDate()",
* message="The start date must be before the end date"
* )
*
* @Assert\Expression(
* "value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()",
* message="The start date must be before warning date"
* )
*/
private $startDate;
/**
* @var \Doctrine\Common\Collections\Collection
* @ORM\OneToMany(
* targetEntity="\Chill\TaskBundle\Entity\Task\SingleTaskPlaceEvent",
* mappedBy="task",
* cascade={ "remove" }
* targetEntity="\Chill\TaskBundle\Entity\Task\SingleTaskPlaceEvent",
* mappedBy="task",
* cascade={ "remove" }
* )
*/
private $taskPlaceEvents;
/**
* @var DateInterval
* and this.getEndDate() === null
*
* @ORM\Column(name="warning_interval", type="dateinterval", nullable=true)
*
* @Assert\Expression(
* "!(value != null and this.getEndDate() == null)",
* message="An end date is required if a warning interval is set"
* )
*/
private $warningInterval;
public function __construct()
{
$this->taskPlaceEvents = new ArrayCollection();
}
/**
* Get endDate.
*
* @return DateTime
*/
public function getEndDate()
{
return $this->endDate;
}
/**
* Get id
* Get id.
*
* @return int
*/
@@ -118,85 +133,33 @@ class SingleTask extends AbstractTask
return $this->id;
}
/**
* Set startDate
*
* @param \DateTime $startDate
*
* @return SingleTask
*/
public function setStartDate($startDate)
public function getRecurringTask(): RecurringTask
{
$this->startDate = $startDate;
return $this;
return $this->recurringTask;
}
/**
* Get startDate
* Get startDate.
*
* @return \DateTime
* @return DateTime
*/
public function getStartDate()
{
return $this->startDate;
}
/**
* Set endDate
*
* @param \DateTime $endDate
*
* @return SingleTask
*/
public function setEndDate($endDate)
public function getTaskPlaceEvents(): Collection
{
$this->endDate = $endDate;
return $this;
}
/**
* Get endDate
*
* @return \DateTime
*/
public function getEndDate()
{
return $this->endDate;
}
/**
* Set warningInterval
*
* @param string $warningInterval
*
* @return SingleTask
*/
public function setWarningInterval($warningInterval)
{
$this->warningInterval = $warningInterval;
return $this;
}
/**
* Get warningInterval
*
* @return \DateInterval
*/
public function getWarningInterval()
{
return $this->warningInterval;
return $this->taskPlaceEvents;
}
/**
* Get the Warning date, computed from the difference between the
* end date and the warning interval
* end date and the warning interval.
*
* Return null if warningDate or endDate is null
*
* @return \DateTimeImmutable
* @return DateTimeImmutable
*/
public function getWarningDate()
{
@@ -208,23 +171,51 @@ class SingleTask extends AbstractTask
return null;
}
return \DateTimeImmutable::createFromMutable($this->getEndDate())
return DateTimeImmutable::createFromMutable($this->getEndDate())
->sub($this->getWarningInterval());
}
function getRecurringTask(): RecurringTask
/**
* Get warningInterval.
*
* @return DateInterval
*/
public function getWarningInterval()
{
return $this->recurringTask;
return $this->warningInterval;
}
function setRecurringTask(RecurringTask $recurringTask)
/**
* Set endDate.
*
* @param DateTime $endDate
*
* @return SingleTask
*/
public function setEndDate($endDate)
{
$this->endDate = $endDate;
return $this;
}
public function setRecurringTask(RecurringTask $recurringTask)
{
$this->recurringTask = $recurringTask;
}
public function getTaskPlaceEvents(): Collection
/**
* Set startDate.
*
* @param DateTime $startDate
*
* @return SingleTask
*/
public function setStartDate($startDate)
{
return $this->taskPlaceEvents;
$this->startDate = $startDate;
return $this;
}
public function setTaskPlaceEvents(Collection $taskPlaceEvents)
@@ -233,5 +224,18 @@ class SingleTask extends AbstractTask
return $this;
}
}
/**
* Set warningInterval.
*
* @param string $warningInterval
*
* @return SingleTask
*/
public function setWarningInterval($warningInterval)
{
$this->warningInterval = $warningInterval;
return $this;
}
}