Renders the address.

@param AddressInterface|int $addressOrId
@param bool $displayPhones
@return string
171532
public function renderAddress($addressOrId, $displayPhones = true)
    {
        if ($addressOrId instanceOf AddressInterface) {
            $address = $addressOrId;
        } else {
            $addressOrId = intval($addressOrId);
            if (0 >= $addressOrId || null === $address = $this->repository->find($addressOrId)) {
                return '';
            }
        }

        return $this->addressTemplate->render(['address' => $address, 'display_phones' => $displayPhones]);
    }
1066004
public function emailOutputTo($addresses)
    {
        if (is_null($this->_output) || $this->_output == $this->getDefaultOutput()) {
            throw new InvalidCallException("Must direct output to a file in order to e-mail results.");
        }
        $addresses = is_array($addresses) ? $addresses : func_get_args();
        return $this->then(function (Application $app) use ($addresses) {
            $this->emailOutput($app->mailer, $addresses);
        });
    }
398577
public function deleteFromId( $contactAddressId){
        $rest = $this->getService( self::API_ADDRESS . $contactAddressId);
        $rest->DELETE();

        return $rest->getSuccess();
    }
1362475
protected void setAddressVisible(boolean visible) {

        Style style = m_addressLabel.getElement().getParentElement().getStyle();
        if (visible) {
            style.clearDisplay();
        } else {
            style.setDisplay(Display.NONE);
        }
    }
498918
public function format(
        AddressInterface $address,
        $locale = null,
        $html = true,
        $htmlTag = "p",
        $htmlAttributes = []
    ) {
        $locale = $this->normalizeLocale($locale);

        $addressFormatRepository = new AddressFormatRepository();
        $countryRepository = new CountryRepository();
        $subdivisionRepository = new SubdivisionRepository();

        $formatter = new DefaultFormatter(
            $addressFormatRepository,
            $countryRepository,
            $subdivisionRepository,
            $locale
        );

        $formatter->setOption('html', $html);
        $formatter->setOption('html_tag', $htmlTag);
        $formatter->setOption('html_attributes', $htmlAttributes);


        $addressFormatted = $formatter->format($address);

        return $addressFormatted;
    }
305941
public function processPhones($contact, $phones)
    {
        $get = function($phone) {
            return $phone->getId();
        };

        $delete = function($phone) use ($contact) {
            return $contact->removePhone($phone);
        };

        $update = function($phone, $matchedEntry) {
            return $this->updatePhone($phone, $matchedEntry);
        };

        $add = function($phone) use ($contact) {
            return $this->addPhone($contact, $phone);
        };

        $entities = $contact->getPhones();

        $result = $this->processSubEntities(
            $entities,
            $phones,
            $get,
            $add,
            $update,
            $delete
        );

        $this->resetIndexOfSubentites($entities);

        // check main
        $this->setMainPhone($contact);

        return $result;
    }
383466
public function replaceOrderAddressWithCustomerAddress(string $orderAddressId, string $customerAddressId, Context $context): JsonResponse
    {
        $this->recalculationService->replaceOrderAddressWithCustomerAddress($orderAddressId, $customerAddressId, $context);

        return new JsonResponse(null, Response::HTTP_NO_CONTENT);
    }
450545
public function createAddress(int $customerId, Address $address): ?int
    {
        return $this->restClient->createResource(
            $address,
            sprintf(self::CUSTOMER_ADDRESS, $customerId)
        );
    }
844728
protected function arrayToAddress($addresses) {
        $addressesAsString = array();
        foreach ($addresses as $address) {
            $addressesAsString[] = $this->toAddress($address);
        }
        return $addressesAsString;
    }
833257
public static String formatAddress(InetSocketAddress inet){
        if(inet == null){
            throw new NullPointerException();
        }
        StringBuilder result = new StringBuilder();
        if(inet.isUnresolved()){
            result.append(inet.getHostName());
        }else{
            result.append(formatPossibleIpv6Address(formatAddress(inet.getAddress())));
        }
        result.append(":").append(inet.getPort());
        return result.toString();
    }
560576
protected function formatEmailAddress($address, $title)
    {
        if (!empty($title)) {
            $address = sprintf('"%s" <%s>', $title, $address);
        }
        return $address;
    }
1354284
private function buildFullAddressString(
        AddressInterface $address,
        array $cityHierarchy
    ) {
        $cityString = implode(', ', $cityHierarchy);

        return sprintf(
            '%s %s, %s %s',
            $address->getAddress(),
            $address->getAddressMore(),
            $cityString,
            $address->getPostalcode()
        );
    }
657219
public function geolocateIPAddress(AddressInterface $address)
    {
        $result = new GeolocationResult();
        try {
            switch ($address->getRangeType()) {
                case IPRangeType::T_PUBLIC:
                    $addressString = (string) $address;
                    $session = $this->app->make('session');
                    $sessionKey = 'ccm/geolocation/' . $this->geolocator->getGeolocatorHandle() . '/' . $this->geolocator->getGeolocatorID() . '/' . md5(serialize($this->geolocator->getGeolocatorConfiguration())) . '/' . $addressString;
                    if ($session->has($sessionKey)) {
                        $result = $session->get($sessionKey);
                    } else {
                        $result = $this->performGeolocation($address);
                        $session->set($sessionKey, $result);
                    }
                    break;
                default:
                    $result->setError(GeolocationResult::ERR_IPNOTPUBLIC);
                    break;
            }
        } catch (Exception $x) {
            $result->setError(GeolocationResult::ERR_OTHER, '', $x);
        } catch (Throwable $x) {
            $result->setError(GeolocationResult::ERR_OTHER, '', new Exception($x->getMessage(), $x->getCode()));
        }

        return $result;
    }
593824
public function getContactData($addressData, $contact)
    {
        $result = array();
        // if account is set, take account's name
        if ($addressData && isset($addressData['firstName']) && isset($addressData['lastName'])) {
            $result['firstName'] = $addressData['firstName'];
            $result['lastName'] = $addressData['lastName'];
            $result['fullName'] = $result['firstName'] . ' ' . $result['lastName'];
            if (isset($addressData['title'])) {
                $result['title'] = $addressData['title'];
            }
            if (isset($addressData['salutation'])) {
                $result['salutation'] = $addressData['salutation'];
            }
        } else {
            if ($contact) {
                $result['firstName'] = $contact->getFirstName();
                $result['lastName'] = $contact->getLastName();
                $result['fullName'] = $contact->getFullName();
                $result['salutation'] = $contact->getFormOfAddress();
                if ($contact->getTitle() !== null) {
                    $result['title'] = $contact->getTitle()->getTitle();
                }
            } else {
                throw new MissingOrderAttributeException('firstName, lastName or contact');
            }
        }

        return $result;
    }
324114
public function emailOutputTo($addresses, $onlyIfOutputExists = false)
    {
        $this->ensureOutputIsBeingCapturedForEmail();

        $addresses = Arr::wrap($addresses);

        return $this->then(
            function (Mailer $mailer) use ($addresses, $onlyIfOutputExists) {
                $this->emailOutput($mailer, $addresses, $onlyIfOutputExists);
            }
        );
    }
647357
public function getAdressesMemeLocalite($idAdresse = 0, $typeLocalite = 'rue')
    {
        // lien retour vers l'affichage du detail de l'adresse
        $html="<a href=\"".$this->creerUrl('', 'adresseDetail', array('archiIdAdresse'=>$idAdresse))."\">Retour</a><br>";

        // recuperation des adresses liees
        $reqAdresses = "

            SELECT ha1.idAdresse as idAdresse,ha1.idRue as idRue, ha1.idQuartier as idQuartier, ha1.idSousQuartier as idSousQuartier, ha1.idPays as idPays , ha1.idVille as idVille
            FROM historiqueAdresse ha2, historiqueAdresse ha1
            WHERE ha2.idAdresse = ha1.idAdresse
            AND ha1.idAdresse = '".$idAdresse."'
            GROUP BY ha1.idAdresse, ha1.idHistoriqueAdresse
            HAVING ha1.idHistoriqueAdresse = max(ha2.idHistoriqueAdresse)
        ";

        $res = $this->connexionBdd->requete($reqAdresses);

        $rues = array();
        $quartiers = array();
        $sousQuartiers = array();
        $pays = array();
        $villes = array();
        $sql="";
        $tabIdAdressesNotToDisplay = array();
        $arrayComplementTitre=array();
        if (mysql_num_rows($res)>0) {
            while ($fetch = mysql_fetch_assoc($res)) {
                //$tabAdresses[] = array('idRue'=>$fetch['idRue'],'idQuartier'=>$fetch['idQuartier'],'idSousQuartier'=>$fetch['idSousQuartier'],'idPays'=>$fetch['idPays'],'idVille'=>$fetch['idVille']);
                if ($typeLocalite=="rue") {
                    if ($fetch['idRue']!='0') {
                        $rues[] = $fetch['idRue'];
                    }

                    $arrayComplementTitre[]="à la rue";
                } elseif ($typeLocalite=="quartier") {
                    // recherche du quartier
                    if ($fetch['idRue']!='0') {
                    // recherche du quartier de la rue
                        $reqQuartier = "
                            SELECT q.idQuartier as idQuartier
                            FROM quartier q
                            RIGHT JOIN sousQuartier sq ON sq.idQuartier = q.idQuartier
                            RIGHT JOIN rue r ON r.idSousQuartier = sq.idSousQuartier
                            WHERE r.idRue = '".$fetch['idRue']."'
                        ";

                        $resQuartier = $this->connexionBdd->requete($reqQuartier);

                        while ($fetchQuartier = mysql_fetch_assoc($resQuartier)) {
                            $quartiers[] = $fetchQuartier['idQuartier'];
                        }
                    }

                    if ($fetch['idQuartier']!='0') {
                        $quartiers[] = $fetch['idQuartier'];
                    }

                    $arrayComplementTitre[]="au quartier";
                }

                    $tabIdAdressesNotToDisplay[]=$fetch['idAdresse'];
            }

            if (count($rues)>0) {
                $sql.=" AND ha1.idRue in ('".implode("','", array_unique($rues))."') ";
            }

            if (count($quartiers)>0) {
                $sql.=" AND q.idQuartier in ('".implode("','", array_unique($quartiers))."') ";
            }

            if (count($rues)==0 && count($quartiers)==0) {
                $sql.=" AND ha1.idAdresse ='0' ";
            }


            $sql.=" AND ha1.idAdresse not in ('".implode("','", $tabIdAdressesNotToDisplay)."') ";
        }

        // affichage de la liste des adresses
        $retour = $this->afficherListe(array('sqlSelectionExterne'=>$sql,'titre'=>'Adresses relatives '.implode(",", $arrayComplementTitre).': ','desactivateRedirection'=>1));

        $html .=$retour['html'];

        return $html;
    }
265128
public function format(PhoneNumber $phoneNumber, $format = PhoneNumberFormat::INTERNATIONAL)
    {
        if (true === is_string($format)) {
            $constant = '\libphonenumber\PhoneNumberFormat::' . $format;

            if (false === defined($constant)) {
                throw new InvalidArgumentException('The format must be either a constant value or name in libphonenumber\PhoneNumberFormat');
            }

            $format = constant('\libphonenumber\PhoneNumberFormat::' . $format);
        }

        return $this->phoneNumberUtil->format($phoneNumber, $format);
    }