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,29 +1,40 @@
<?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\DocGeneratorBundle\Context;
/**
* Interface for context for for document generation
* Interface for context for for document generation.
*/
interface DocGeneratorContextInterface
{
/**
* has form
* Get the data that will be injected to the generated document.
*
* @param mixed $entity
*/
public function hasForm(): bool;
public function getData($entity): array;
/**
* Generate the form that display
* Generate the form that display.
*
* @param mixed $entity
*/
public function getForm($entity);
/**
* True of false which entity supports
* has form.
*/
public function supports(string $entityClass): bool;
public function hasForm(): bool;
/**
* Get the data that will be injected to the generated document
* True of false which entity supports.
*/
public function getData($entity): array;
public function supports(string $entityClass): bool;
}

View File

@@ -1,31 +1,76 @@
<?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\DocGeneratorBundle\Context;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Exception;
/**
* Context that display a form to select a member of a houseHold
* Context that display a form to select a member of a houseHold.
*/
class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
{
/**
* has form
* Get the data that will be injected to the generated document.
*
* @param mixed $entity
*/
public function hasForm(): bool {
return true;
public function getData($entity): array
{
$datas = [
'setValues' => [],
'cloneRowAndSetValues' => [],
];
$persons = $entity->getAccompanyingPeriodWork()->getPersons();
if (sizeof($persons) > 0) {
$firstPerson = $persons[0];
$datas['setValues'][] = [
'firstPersonFirstName' => $firstPerson->getFirstName(),
'firstPersonLastName' => $firstPerson->getLastName(), ];
}
if (get_class($entity) == AccompanyingPeriodWorkEvaluation::class) {
$values = [];
foreach ($entity->getAccompanyingPeriodWork()->getPersons() as $person) {
$i = 1;
$values[] = [
'personRowId' => $i,
'personFirstName' => $person->getFirstName(),
'personLastName' => $person->getLastName(),
];
}
$datas['cloneRowAndSetValues'][] = [
'personRowId', $values, ];
}
return $datas;
}
/**
* Generate the form that display
* Generate the form that display.
*
* @param mixed $entity
*/
public function getForm($entity) {
throw new \Exception("No implemented yet", 1);
public function getForm($entity)
{
throw new Exception('No implemented yet', 1);
$choices = [];
if(get_class($entity) == AccompanyingPeriodWorkEvaluation::class) {
if (get_class($entity) == AccompanyingPeriodWorkEvaluation::class) {
foreach ($entity->getAccompanyingPeriodWork()->getPersons() as $person) {
$choices[$person->getId()] = $person->getName();
}
@@ -34,56 +79,27 @@ class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
$builder->add('members', ChoiceType::class, [
'choices' => $choices,
'placeholder' => 'Choose a person',
'label' => 'Person to add'
'label' => 'Person to add',
]);
return $builder;
}
/**
* True of false which entity supports
* has form.
*/
public function supports(string $entityClass): bool {
return
($entityClass == AccompanyingPeriod::class) ||
($entityClass == SocialAction::class);
public function hasForm(): bool
{
return true;
}
/**
* Get the data that will be injected to the generated document
* True of false which entity supports.
*/
public function getData($entity): array {
$datas = array(
'setValues' => array(),
'cloneRowAndSetValues' => array()
);
$persons = $entity->getAccompanyingPeriodWork()->getPersons();
if(sizeof($persons) > 0) {
$firstPerson = $persons[0];
$datas['setValues'][] = array(
'firstPersonFirstName' => $firstPerson->getFirstName(),
'firstPersonLastName' => $firstPerson->getLastName(),);
}
if(get_class($entity) == AccompanyingPeriodWorkEvaluation::class) {
$values = array();
foreach($entity->getAccompanyingPeriodWork()->getPersons() as $person) {
$i = 1;
$values[] = array(
'personRowId' => $i,
'personFirstName' => $person->getFirstName(),
'personLastName' => $person->getLastName(),
);
}
$datas['cloneRowAndSetValues'][] = array(
'personRowId', $values);
}
return $datas;
public function supports(string $entityClass): bool
{
return
(AccompanyingPeriod::class == $entityClass)
|| (SocialAction::class == $entityClass);
}
}