public function getAddressAsString()

in app/Models/Account/Place.php [58:93]


    public function getAddressAsString(): ?string
    {
        $address = '';

        if (! is_null($this->street)) {
            $address = $this->street;
        }

        if (! is_null($this->city)) {
            $address .= ' '.$this->city;
        }

        if (! is_null($this->province)) {
            $address .= ' '.$this->province;
        }

        if (! is_null($this->postal_code)) {
            $address .= ' '.$this->postal_code;
        }

        if (! is_null($this->country)) {
            $address .= ' '.$this->getCountryName();
        }

        if (empty($address)) {
            return null;
        }

        // trim extra whitespaces inside the address
        $address = preg_replace('/\s+/', ' ', $address);
        if (is_string($address)) {
            return $address;
        }

        return null;
    }