Prev | Current Page 609 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


substr($this->_mCardNumber, strlen($this->_mCardNumber) - 4, 4);
else
throw new Exception('Data not decrypted');
}
The last six properties (CardHolder, CardNumber, IssueDate, ExpiryDate, IssueNumber, and CardType)
are handled in a single block:
elseif (in_array($name, array ('CardHolder', 'CardNumber', 'IssueDate',
'ExpiryDate', 'IssueNumber', 'CardType')))
{
$name = '_m' . $name;
if ($this->_mIsDecrypted)
return $this->$name;
else
throw new Exception('Data not decrypted');
}
else
{
throw new Exception('Property ' . $name . ' not found');
}
}
Note that in all cases, the data is accessible only when $_mIsDecrypted is true; otherwise, an exception is
thrown.
Also, note that the data isn??™t accessible after encryption??”the data used to initialize a SecureCard object is accessible
only in encrypted form. This is more a use-case decision than anything else because this class is really intended
for encryption and decryption only, not for persistently representing credit card details. After a SecureCard instance
has been used to encrypt card details, we shouldn??™t subsequently need access to the unencrypted data, only the
encrypted string.
CHAPTER 16 ?–  MANAGING CUSTOMER DETAILS 499
?– Note Before moving on to the client code, it is worth explaining and emphasizing one important design
consideration that you have probably already noticed.


Pages:
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621
szkoła narciarska wyrejestrowanie samochodu legnica obciążniki Wczasy nad morzem serwis drukarek katowice