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,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\PersonBundle\Form\DataTransformer;
use Chill\PersonBundle\Entity\Person;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Doctrine\Persistence\ObjectManager;
use Chill\PersonBundle\Entity\Person;
class PersonToIdTransformer implements DataTransformerInterface
{
@@ -14,37 +21,19 @@ class PersonToIdTransformer implements DataTransformerInterface
*/
private $om;
/**
* @param ObjectManager $om
*/
public function __construct(ObjectManager $om)
{
$this->om = $om;
}
/**
* Transforms an object (issue) to a string (id).
*
* @param Person|null $issue
* @return string
*/
public function transform($issue)
{
if (null === $issue) {
return "";
}
return $issue->getId();
}
/**
* Transforms a string (id) to an object (issue).
*
* @param string $id
*
* @return Person|null
*
* @throws TransformationFailedException if object (issue) is not found.
*
* @return Person|null
*/
public function reverseTransform($id)
{
@@ -54,8 +43,7 @@ class PersonToIdTransformer implements DataTransformerInterface
$issue = $this->om
->getRepository('ChillPersonBundle:Person')
->findOneBy(array('id' => $id))
;
->findOneBy(['id' => $id]);
if (null === $issue) {
throw new TransformationFailedException(sprintf(
@@ -66,5 +54,20 @@ class PersonToIdTransformer implements DataTransformerInterface
return $issue;
}
/**
* Transforms an object (issue) to a string (id).
*
* @param Person|null $issue
*
* @return string
*/
public function transform($issue)
{
if (null === $issue) {
return '';
}
return $issue->getId();
}
}
?>