apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -11,16 +11,11 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Templating\Entity;
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
use Chill\MainBundle\Templating\Entity\BoxUtilsChillEntityRenderTrait;
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
use Chill\PersonBundle\Entity\Person;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use function array_key_exists;
/**
* Render a Person.
*/
@@ -50,12 +45,12 @@ class PersonRender implements PersonRenderInterface
];
return
$this->getDefaultOpeningBox('person') .
$this->getDefaultOpeningBox('person').
$this->engine->render('@ChillPerson/Entity/person.html.twig', [
'person' => $person,
'render' => $options['render'] ?? 'raw',
'options' => $params,
]) .
]).
$this->getDefaultClosingBox();
}
@@ -63,19 +58,19 @@ class PersonRender implements PersonRenderInterface
{
$options = array_merge(['addAge' => true], $options);
if (null !== $person->getAge() && $person->getDeathDate() === null && $options['addAge']) {
return $person->getFirstName() . ' ' . $person->getLastName()
. $this->addAltNames($person, false) . ' (' . $this->translator->trans('years_old', ['age' => $person->getAge()]) . ')';
if (null !== $person->getAge() && null === $person->getDeathDate() && $options['addAge']) {
return $person->getFirstName().' '.$person->getLastName()
.$this->addAltNames($person, false).' ('.$this->translator->trans('years_old', ['age' => $person->getAge()]).')';
}
if (null !== $person->getDeathDate() && $options['addAge']) {
return $person->getFirstName() . ' ' . $person->getLastName()
. ' (‡)'
. $this->addAltNames($person, false);
return $person->getFirstName().' '.$person->getLastName()
.' (‡)'
.$this->addAltNames($person, false);
}
return $person->getFirstName() . ' ' . $person->getLastName()
. $this->addAltNames($person, false);
return $person->getFirstName().' '.$person->getLastName()
.$this->addAltNames($person, false);
}
public function supports($entity, array $options): bool
@@ -93,7 +88,7 @@ class PersonRender implements PersonRenderInterface
foreach ($person->getAltNames()->getIterator() as $altName) {
/** @var \Chill\PersonBundle\Entity\PersonAltName $altName */
if (array_key_exists($altName->getKey(), $altNames)) {
if (\array_key_exists($altName->getKey(), $altNames)) {
if ($isFirst) {
$str .= ' (';
$isFirst = false;
@@ -102,7 +97,7 @@ class PersonRender implements PersonRenderInterface
}
if ($addSpan) {
$str .= '<span class="altname altname-' . $altName->getKey() . '">';
$str .= '<span class="altname altname-'.$altName->getKey().'">';
}
$str .= $altName->getLabel();