Tutorial Extension  1.0.0
SellerDeck Extensions - Tutorial Extension
Public Member Functions | Protected Attributes | List of all members
CValidator Class Reference

Public Member Functions

 __construct ($oCatalogDB, $oShippingDB)
 
 ValidateEmail ($sEmail)
 
 ValidateCurrency ($sCurrency)
 

Protected Attributes

 $m_oCatalogDB = null
 
 $m_oShippingDB = null
 

Detailed Description

Definition at line 14 of file CValidator.php.

Constructor & Destructor Documentation

__construct (   $oCatalogDB,
  $oShippingDB 
)

__construct - Object constructor method

public

Parameters
object$oCatalogDBCatalog Database Object
object$oShippingDBShipping Database Object
Returns
void

Definition at line 35 of file CValidator.php.

36  {
37  $this->m_oCatalogDB = $oCatalogDB;
38  $this->m_oShippingDB = $oShippingDB;
39  }

Member Function Documentation

ValidateCurrency (   $sCurrency)

ValidateCurrency - Validate Currency

public

Exceptions
ValidatorException
Parameters
string$sCurrencyCurrency
Returns
string Currency

Definition at line 71 of file CValidator.php.

72  {
73  $aResult = $this->m_oCatalogDB->Select('currencies', '*', [['SINTLSYMBOL', $sCurrency]])->fetch(\PDO::FETCH_ASSOC);
74  if (empty($aResult))
75  {
76  throw new \SDExtension\SDException\InvalidCurrencyException($sCurrency);
77  }
78  return $sCurrency;
79  }
ValidateEmail (   $sEmail)

ValidateEmail - Validate Email address

public

Exceptions
ValidatorException
Parameters
string$sEmailEmail address
Returns
string Email address

Definition at line 49 of file CValidator.php.

50  {
51  if ($sEmail == "Invalid Request")
52  {
53  return null;
54  }
55  if (filter_var($sEmail, FILTER_VALIDATE_EMAIL) === false)
56  {
57  \SDExtension\Helper\CLogger::get(LOG_CHANNEL_NAME)->addError("#" . EXCEPTION_MSG_INVALID_EMAIL . ":" . EXCEPTION_CODE_INVALID_EMAIL);
58  throw new \SDExtension\SDException\ValidatorException(EXCEPTION_MSG_INVALID_EMAIL, EXCEPTION_CODE_INVALID_EMAIL);
59  }
60  return $sEmail;
61  }
static get($sChannel="default", $sLogRoot="")
Definition: CLogger.php:90

The documentation for this class was generated from the following file: