mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-05 05:29:41 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -13,12 +13,6 @@ namespace Chill\MainBundle\Templating\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
|
||||
use function array_merge;
|
||||
use function strtr;
|
||||
|
||||
/**
|
||||
* @implements ChillEntityRenderInterface<Address>
|
||||
@@ -40,7 +34,7 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
|
||||
public function renderBox($addr, array $options): string
|
||||
{
|
||||
$options = array_merge(self::DEFAULT_OPTIONS, $options);
|
||||
$options = \array_merge(self::DEFAULT_OPTIONS, $options);
|
||||
|
||||
return $this->templating
|
||||
->render('@ChillMain/Entity/address.html.twig', [
|
||||
@@ -60,7 +54,7 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
$lines = [];
|
||||
|
||||
if (null !== $addr->getPostcode()) {
|
||||
if ($addr->getPostcode()->getCountry()->getCountryCode() === 'FR') {
|
||||
if ('FR' === $addr->getPostcode()->getCountry()->getCountryCode()) {
|
||||
$lines[] = $this->renderIntraBuildingLine($addr);
|
||||
$lines[] = $this->renderBuildingLine($addr);
|
||||
$lines[] = $this->renderStreetLine($addr);
|
||||
@@ -105,10 +99,10 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
$streetNumber = '';
|
||||
}
|
||||
|
||||
$res = trim($street . ', ' . $streetNumber, ', ');
|
||||
$res = trim($street.', '.$streetNumber, ', ');
|
||||
|
||||
if ($addr->getPostcode()->getCountry()->getCountryCode() === 'FR') {
|
||||
$res = trim($streetNumber . ', ' . $street, ', ');
|
||||
if ('FR' === $addr->getPostcode()->getCountry()->getCountryCode()) {
|
||||
$res = trim($streetNumber.', '.$street, ', ');
|
||||
}
|
||||
|
||||
if ((',' === $res) || ('' === $res)) {
|
||||
@@ -130,7 +124,7 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
|
||||
private function renderBuildingLine(Address $addr): ?string
|
||||
{
|
||||
if ($addr->getBuildingName() !== '') {
|
||||
if ('' !== $addr->getBuildingName()) {
|
||||
$building = $addr->getBuildingName();
|
||||
} else {
|
||||
$building = '';
|
||||
@@ -141,13 +135,13 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
$intraBuilding = '';
|
||||
}
|
||||
|
||||
$res = trim($building . ' - ' . $intraBuilding, ' - ');
|
||||
$res = trim($building.' - '.$intraBuilding, ' - ');
|
||||
|
||||
if ('' === $res) {
|
||||
$res = null;
|
||||
}
|
||||
|
||||
if ($addr->getPostcode()->getCountry()->getCountryCode() === 'FR') {
|
||||
if ('FR' === $addr->getPostcode()->getCountry()->getCountryCode()) {
|
||||
$res = $addr->getBuildingName();
|
||||
}
|
||||
|
||||
@@ -157,14 +151,14 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
private function renderCityLine(Address $addr): string
|
||||
{
|
||||
if (null !== $addr->getPostcode()) {
|
||||
$res = strtr('{postcode} {label}', [
|
||||
$res = \strtr('{postcode} {label}', [
|
||||
'{postcode}' => $addr->getPostcode()->getCode(),
|
||||
'{label}' => $addr->getPostcode()->getName(),
|
||||
]);
|
||||
|
||||
if ($addr->getPostcode()->getCountry()->getCountryCode() === 'FR') {
|
||||
if ('FR' === $addr->getPostcode()->getCountry()->getCountryCode()) {
|
||||
if ('' !== $addr->getDistribution()) {
|
||||
$res = $res . ' ' . $addr->getDistribution();
|
||||
$res = $res.' '.$addr->getDistribution();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,19 +183,19 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
$arr = [];
|
||||
|
||||
if ('' !== $addr->getFlat()) {
|
||||
$arr[] = 'appart ' . $addr->getFlat();
|
||||
$arr[] = 'appart '.$addr->getFlat();
|
||||
}
|
||||
|
||||
if ('' !== $addr->getFloor()) {
|
||||
$arr[] = 'ét ' . $addr->getFloor();
|
||||
$arr[] = 'ét '.$addr->getFloor();
|
||||
}
|
||||
|
||||
if ('' !== $addr->getCorridor()) {
|
||||
$arr[] = 'coul ' . $addr->getCorridor();
|
||||
$arr[] = 'coul '.$addr->getCorridor();
|
||||
}
|
||||
|
||||
if ('' !== $addr->getSteps()) {
|
||||
$arr[] = 'esc ' . $addr->getSteps();
|
||||
$arr[] = 'esc '.$addr->getSteps();
|
||||
}
|
||||
|
||||
$res = implode(' - ', $arr);
|
||||
|
||||
Reference in New Issue
Block a user