Current File : //var/www/vinorea/modules/psxmarketingwithgoogle/classes/Conversion/UserAddressData.php |
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PrestaShop\Module\PsxMarketingWithGoogle\Conversion;
use JsonSerializable;
class UserAddressData implements JsonSerializable
{
/**
* @var string|null
*/
private $firstName;
/**
* @var string|null
*/
private $lastName;
/**
* @var string|null
*/
private $street;
/**
* @var string|null
*/
private $city;
/**
* @var string|null
*/
private $region;
/**
* @var string|null
*/
private $postalCode;
/**
* @var string|null
*/
private $country;
public function jsonSerialize(): array
{
$data = [];
if (!empty($this->firstName)) {
$data['sha256_first_name'] = $this->firstName;
}
if (!empty($this->lastName)) {
$data['sha256_last_name'] = $this->lastName;
}
if (!empty($this->street)) {
$data['street'] = $this->street;
}
if (!empty($this->city)) {
$data['city'] = $this->city;
}
if (!empty($this->region)) {
$data['region'] = $this->region;
}
if (!empty($this->postalCode)) {
$data['postal_code'] = $this->postalCode;
}
if (!empty($this->country)) {
$data['country'] = $this->country;
}
return $data;
}
/**
* @return bool
*/
public function isEmpty()
{
foreach (get_object_vars($this) as $value) {
if (!empty($value)) {
return false;
}
}
return true;
}
/**
* Get the value of firstName
*
* @return string
*/
public function getFirstName()
{
return $this->firstName;
}
/**
* Set the value of firstName
*
* @param string|null $firstName
*
* @return self
*/
public function setFirstName($firstName)
{
$this->firstName = $firstName;
return $this;
}
/**
* Get the value of lastName
*
* @return string
*/
public function getLastName()
{
return $this->lastName;
}
/**
* Set the value of lastName
*
* @param string|null $lastName
*
* @return self
*/
public function setLastName($lastName)
{
$this->lastName = $lastName;
return $this;
}
/**
* Get the value of street
*
* @return string
*/
public function getStreet()
{
return $this->street;
}
/**
* Set the value of street
*
* @param string|null $street
*
* @return self
*/
public function setStreet($street)
{
$this->street = $street;
return $this;
}
/**
* Get the value of city
*
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* Set the value of city
*
* @param string|null $city
*
* @return self
*/
public function setCity($city)
{
$this->city = $city;
return $this;
}
/**
* Get the value of region
*
* @return string
*/
public function getRegion()
{
return $this->region;
}
/**
* Set the value of region
*
* @param string|null $region
*
* @return self
*/
public function setRegion($region)
{
$this->region = $region;
return $this;
}
/**
* Get the value of postalCode
*
* @return string
*/
public function getPostalCode()
{
return $this->postalCode;
}
/**
* Set the value of postalCode
*
* @param string|null $postalCode
*
* @return self
*/
public function setPostalCode($postalCode)
{
$this->postalCode = $postalCode;
return $this;
}
/**
* Get the value of country
*
* @return string
*/
public function getCountry()
{
return $this->country;
}
/**
* Set the value of country
*
* @param string|null $country
*
* @return self
*/
public function setCountry($country)
{
$this->country = $country;
return $this;
}
}