mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-05 05:29:41 +00:00
Merge remote-tracking branch 'origin/master' into track-address-reference-update
This commit is contained in:
@@ -20,6 +20,9 @@ use Symfony\Component\Templating\EngineInterface;
|
||||
use function array_merge;
|
||||
use function strtr;
|
||||
|
||||
/**
|
||||
* @implements ChillEntityRenderInterface<Address>
|
||||
*/
|
||||
class AddressRender implements ChillEntityRenderInterface
|
||||
{
|
||||
public const DEFAULT_OPTIONS = [
|
||||
@@ -39,16 +42,12 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
|
||||
public function __construct(
|
||||
EngineInterface $templating,
|
||||
TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
) {
|
||||
$this->templating = $templating;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Address addr
|
||||
* @param mixed $addr
|
||||
*/
|
||||
public function renderBox($addr, array $options): string
|
||||
{
|
||||
$options = array_merge(self::DEFAULT_OPTIONS, $options);
|
||||
@@ -70,8 +69,8 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
{
|
||||
$lines = [];
|
||||
|
||||
if (null !== $addr->getPostCode()) {
|
||||
if ($addr->getPostCode()->getCountry()->getCountryCode() === 'FR') {
|
||||
if (null !== $addr->getPostcode()) {
|
||||
if ($addr->getPostcode()->getCountry()->getCountryCode() === 'FR') {
|
||||
$lines[] = $this->renderIntraBuildingLine($addr);
|
||||
$lines[] = $this->renderBuildingLine($addr);
|
||||
$lines[] = $this->renderStreetLine($addr);
|
||||
@@ -118,10 +117,8 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
|
||||
$res = trim($street . ', ' . $streetNumber, ', ');
|
||||
|
||||
if (null !== $addr->getPostCode()->getCountry()->getCountryCode()) {
|
||||
if ($addr->getPostCode()->getCountry()->getCountryCode() === 'FR') {
|
||||
$res = trim($streetNumber . ', ' . $street, ', ');
|
||||
}
|
||||
if ($addr->getPostcode()->getCountry()->getCountryCode() === 'FR') {
|
||||
$res = trim($streetNumber . ', ' . $street, ', ');
|
||||
}
|
||||
|
||||
if ((',' === $res) || ('' === $res)) {
|
||||
@@ -131,10 +128,6 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Address addr
|
||||
* @param mixed $addr
|
||||
*/
|
||||
public function renderString($addr, array $options): string
|
||||
{
|
||||
return implode(' — ', $this->renderLines($addr));
|
||||
@@ -164,10 +157,8 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
$res = null;
|
||||
}
|
||||
|
||||
if (null !== $addr->getPostCode()->getCountry()->getCountryCode()) {
|
||||
if ($addr->getPostCode()->getCountry()->getCountryCode() === 'FR') {
|
||||
$res = $addr->getBuildingName();
|
||||
}
|
||||
if ($addr->getPostcode()->getCountry()->getCountryCode() === 'FR') {
|
||||
$res = $addr->getBuildingName();
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
Reference in New Issue
Block a user