/home/sharedstore/public_html/prestashop.sharedstore.ma/classes
Edit: /home/sharedstore/public_html/prestashop.sharedstore.ma/classes/AddressChecksumCore.php (1851B)
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
/**
* Class AddressChecksumCore.
*/
class AddressChecksumCore implements ChecksumInterface
{
public const SEPARATOR = '_';
/**
* Generate a checksum.
*
* @param Address $address
*
* @return string SHA1 checksum for the Address
*/
public function generateChecksum($address)
{
if (!$address->id) {
return sha1('No address set');
}
$uniqId = '';
try {
$fields = $address->getFields();
} catch (Exception $e) {
return sha1('Invalid address');
}
foreach ($fields as $name => $value) {
$uniqId .= $value . self::SEPARATOR;
}
$uniqId = rtrim($uniqId, self::SEPARATOR);
return sha1($uniqId);
}
}