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,31 +1,59 @@
<?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 Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\HasCenterInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use function array_fill_keys;
use function array_keys;
/**
* AbstractTask
* AbstractTask.
*
* @ORM\MappedSuperclass()
* @ORM\MappedSuperclass
*/
abstract class AbstractTask implements HasScopeInterface, HasCenterInterface
{
/**
* @var User
* @ORM\ManyToOne(
* targetEntity="\Chill\MainBundle\Entity\User"
* )
*/
private $assignee;
/**
* @var string
*
* @ORM\Column(name="type", type="string", length=255)
* @var Scope
* @ORM\ManyToOne(
* targetEntity="\Chill\MainBundle\Entity\Scope"
* )
*/
private $type;
private $circle;
/**
* @var bool
* @ORM\Column(name="closed", type="boolean", options={ "default": false })
*/
private $closed = false;
/**
* @var AccompanyingPeriod
* @ORM\ManyToOne(targetEntity="\Chill\PersonBundle\Entity\AccompanyingPeriod")
*/
private $course;
/**
* @var json
@@ -34,78 +62,111 @@ abstract class AbstractTask implements HasScopeInterface, HasCenterInterface
*/
private $currentStates = [];
/**
* @var string
*
* @ORM\Column(name="description", type="text")
*/
private $description = '';
/**
* @var Person
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Person"
* )
*/
private $person;
/**
* @var string
*
* @ORM\Column(name="title", type="text")
* @Assert\NotBlank()
* @Assert\NotBlank
*/
private $title = '';
/**
* @var string
*
* @ORM\Column(name="description", type="text")
* @ORM\Column(name="type", type="string", length=255)
*/
private $description = '';
private $type;
/**
*
* @var User
* @ORM\ManyToOne(
* targetEntity="\Chill\MainBundle\Entity\User"
* )
*/
private $assignee;
/**
*
* @var Person
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Person"
* )
*/
private $person;
/**
* @var AccompanyingPeriod
* @ORM\ManyToOne(targetEntity="\Chill\PersonBundle\Entity\AccompanyingPeriod")
*/
private $course;
/**
*
* @var Scope
* @ORM\ManyToOne(
* targetEntity="\Chill\MainBundle\Entity\Scope"
* )
*/
private $circle;
/**
* @var boolean
* @ORM\Column(name="closed", type="boolean", options={ "default"=false })
*/
private $closed = false;
/**
* Set type
*
* @param string $type
*
* @return AbstractTask
*/
public function setType($type)
public function getAssignee(): ?User
{
$this->type = (string) $type;
return $this->assignee;
}
return $this;
public function getCenter(): ?\Chill\MainBundle\Entity\Center
{
if ($this->getPerson() instanceof Person) {
return $this->getPerson()->getCenter();
}
return $this->getCourse()->getCenter();
return null;
}
public function getCircle(): ?Scope
{
return $this->circle;
}
public function getContext()
{
return $this->getPerson() ?? $this->getCourse();
}
public function getCourse(): ?AccompanyingPeriod
{
return $this->course;
}
/**
* Get type
* Get currentStates.
*
* The states are returned as required by marking store format.
*
* @return array
*/
public function getCurrentStates()
{
return array_fill_keys($this->currentStates, 1);
}
/**
* Get description.
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
public function getPerson(): ?Person
{
return $this->person;
}
public function getScope(): ?Scope
{
return $this->getCircle();
}
/**
* Get title.
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Get type.
*
* @return string
*/
@@ -114,8 +175,39 @@ abstract class AbstractTask implements HasScopeInterface, HasCenterInterface
return $this->type;
}
public function isClosed(): bool
{
return $this->closed;
}
public function setAssignee(?User $assignee = null)
{
$this->assignee = $assignee;
return $this;
}
public function setCircle(Scope $circle)
{
$this->circle = $circle;
return $this;
}
public function setClosed(bool $closed)
{
$this->closed = $closed;
}
public function setCourse(AccompanyingPeriod $course)
{
$this->course = $course;
return $this;
}
/**
* Set currentStates
* Set currentStates.
*
* The current states are sorted in a single array, non associative.
*
@@ -125,25 +217,34 @@ abstract class AbstractTask implements HasScopeInterface, HasCenterInterface
*/
public function setCurrentStates($currentStates)
{
$this->currentStates = \array_keys($currentStates);
$this->currentStates = array_keys($currentStates);
return $this;
}
/**
* Get currentStates
* Set description.
*
* The states are returned as required by marking store format.
* @param string $description
*
* @return array
* @return AbstractTask
*/
public function getCurrentStates()
public function setDescription($description)
{
return \array_fill_keys($this->currentStates, 1);
$this->description = (string) $description;
return $this;
}
public function setPerson(Person $person)
{
$this->person = $person;
return $this;
}
/**
* Set title
* Set title.
*
* @param string $title
*
@@ -157,120 +258,16 @@ abstract class AbstractTask implements HasScopeInterface, HasCenterInterface
}
/**
* Get title
* Set type.
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set description
*
* @param string $description
* @param string $type
*
* @return AbstractTask
*/
public function setDescription($description)
public function setType($type)
{
$this->description = (string) $description;
$this->type = (string) $type;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
public function getAssignee(): ?User
{
return $this->assignee;
}
public function getPerson(): ?Person
{
return $this->person;
}
public function getCourse(): ?AccompanyingPeriod
{
return $this->course;
}
public function getCircle(): ?Scope
{
return $this->circle;
}
public function setAssignee(User $assignee = null)
{
$this->assignee = $assignee;
return $this;
}
public function setPerson(Person $person)
{
$this->person = $person;
return $this;
}
public function setCourse(AccompanyingPeriod $course)
{
$this->course = $course;
return $this;
}
public function setCircle(Scope $circle)
{
$this->circle = $circle;
return $this;
}
public function getCenter(): ?\Chill\MainBundle\Entity\Center
{
if ($this->getPerson() instanceof Person) {
return $this->getPerson()->getCenter();
} else {
return $this->getCourse()->getCenter();
}
return null;
}
public function getContext()
{
return $this->getPerson() ?? $this->getCourse();
}
public function getScope(): ?\Chill\MainBundle\Entity\Scope
{
return $this->getCircle();
}
/**
* @return bool
*/
public function isClosed(): bool
{
return $this->closed;
}
/**
*
* @param bool $closed
*/
public function setClosed(bool $closed)
{
$this->closed = $closed;
}
}