phpDocumentor

CustomerConfigurationProvider
in package

Class CustomerConfigurationProvider

Table of Contents

$configuration  : array<string|int, mixed>
$configurationTable  : array<string|int, mixed>
$db  : CI_DB_query_builder
$defaultStatusId  : mixed
$display  : array<string|int, mixed>
$errorMessages  : array<string|int, mixed>
$gmConfigurationTable  : array<string|int, mixed>
$languageTextManager  : LanguageTextManager
$minLength  : array<string|int, mixed>
__construct()  : mixed
CustomerConfigurationProvider constructor.
configuration()  : bool
Checks if given configuration is enabled.
defaultStatusId()  : int
Provides the default status id for customers and guests.
display()  : bool
Should the provided configuration field be displayed? Allowed fields are 'gender', 'dob', 'dateOfBirth', 'company', 'state', 'telephone', 'fax', 'suburb'.
errorMessage()  : string
Error message for provided configuration field.
minLength()  : int
Minimum length of provided configuration field.
checkIfFieldExists()  : $this|CustomerConfigurationProvider
Checks if given configuration field exists.
isConfigurationValueTrue()  : bool
Checks if the value is one of the different presentations of true from the different config table sources.

Properties

$configuration

private static array<string|int, mixed> $configuration = ['acceptPrivacy' => ['table' => 'gx_configurations', 'keys' => ['gm_configuration/GM_SHOW_PRIVACY_REGISTRATION', 'gm_configuration/PRIVACY_CHECKBOX_REGISTRATION']], 'optionalNames' => ['table' => 'gx_configurations', 'keys' => ['configuration/ACCOUNT_NAMES_OPTIONAL']], 'splitStreetInformation' => ['table' => 'gx_configurations', 'keys' => ['configuration/ACCOUNT_SPLIT_STREET_INFORMATION']], 'moveOnlyIfNoGuest' => ['table' => 'gx_configurations', 'keys' => ['configuration/MOVE_ONLY_IF_NO_GUEST']], 'genderMandatory' => ['table' => 'gx_configurations', 'keys' => ['configuration/GENDER_MANDATORY']]]

$configurationTable

private static array<string|int, mixed> $configurationTable = ['table' => 'gx_configurations', 'key' => 'key', 'value' => 'value']

$defaultStatusId

private static mixed $defaultStatusId = ['customer' => 'configuration/DEFAULT_CUSTOMERS_STATUS_ID', 'guest' => 'configuration/DEFAULT_CUSTOMERS_STATUS_ID_GUEST']

$display

private static array<string|int, mixed> $display = ['gender' => 'configuration/ACCOUNT_GENDER', 'dob' => 'configuration/ACCOUNT_DOB', 'dateOfBirth' => 'configuration/ACCOUNT_DOB', 'company' => 'configuration/ACCOUNT_COMPANY', 'state' => 'configuration/ACCOUNT_STATE', 'telephone' => 'configuration/ACCOUNT_TELEPHONE', 'fax' => 'configuration/ACCOUNT_FAX', 'suburb' => 'configuration/ACCOUNT_SUBURB', 'countryZone' => 'configuration/ACCOUNT_STATE']

$errorMessages

private static array<string|int, mixed> $errorMessages = ['gender' => 'ENTRY_GENDER_ERROR', 'firstName' => 'ENTRY_FIRST_NAME_ERROR', 'lastName' => 'ENTRY_LAST_NAME_ERROR', 'dob' => 'ENTRY_DATE_OF_BIRTH_ERROR', 'dateOfBirth' => 'ENTRY_DATE_OF_BIRTH_ERROR', 'company' => 'ENTRY_COMPANY_ERROR', 'vatNumber' => 'ENTRY_VAT_ERROR', 'email' => 'ENTRY_EMAIL_ADDRESS_ERROR', 'emailAddressCheck' => 'ENTRY_EMAIL_ADDRESS_CHECK_ERROR', 'emailConfirmation' => 'ENTRY_EMAIL_ADDRESS_CONFIRM_DIFFERENT_ERROR', 'emailExists' => 'ENTRY_EMAIL_ADDRESS_ERROR_EXISTS', 'street' => 'ENTRY_STREET_ADDRESS_ERROR', 'houseNumber' => 'ENTRY_HOUSENUMBER_ERROR', 'postcode' => 'ENTRY_POST_CODE_ERROR', 'city' => 'ENTRY_CITY_ERROR', 'country' => 'ENTRY_COUNTRY_ERROR', 'countryZone' => 'ENTRY_STATE_ERROR', 'countryZoneSelection' => 'ENTRY_STATE_ERROR_SELECT', 'telephone' => 'ENTRY_TELEPHONE_NUMBER_ERROR', 'password' => 'ENTRY_PASSWORD_ERROR', 'passwordMismatch' => 'ENTRY_PASSWORD_ERROR_NOT_MATCHING', 'privacy' => 'ENTRY_PRIVACY_ERROR', 'invalidInput' => 'ENTRY_MAX_LENGTH_ERROR']

$gmConfigurationTable

private static array<string|int, mixed> $gmConfigurationTable = ['table' => 'gx_configurations', 'key' => 'key', 'value' => 'value']

$minLength

private static array<string|int, mixed> $minLength = ['firstName' => 'configuration/ENTRY_FIRST_NAME_MIN_LENGTH', 'lastName' => 'configuration/ENTRY_LAST_NAME_MIN_LENGTH', 'dateOfBirth' => 'configuration/ENTRY_DOB_MIN_LENGTH', 'dob' => 'configuration/ENTRY_DOB_MIN_LENGTH', 'email' => 'configuration/ENTRY_EMAIL_ADDRESS_MIN_LENGTH', 'street' => 'configuration/ENTRY_STREET_ADDRESS_MIN_LENGTH', 'houseNumber' => 'configuration/ENTRY_HOUSENUMBER_MIN_LENGTH', 'company' => 'configuration/ENTRY_COMPANY_MIN_LENGTH', 'postcode' => 'configuration/ENTRY_POSTCODE_MIN_LENGTH', 'city' => 'configuration/ENTRY_CITY_MIN_LENGTH', 'countryZone' => 'configuration/ENTRY_STATE_MIN_LENGTH', 'suburb' => 'configuration/ENTRY_STATE_MIN_LENGTH', 'state' => 'configuration/ENTRY_STATE_MIN_LENGTH', 'telephone' => 'configuration/ENTRY_TELEPHONE_MIN_LENGTH', 'password' => 'configuration/ENTRY_PASSWORD_MIN_LENGTH']

Methods

__construct()

CustomerConfigurationProvider constructor.

public __construct(CI_DB_query_builder $db, LanguageTextManager $languageTextManager) : mixed
Parameters
$db : CI_DB_query_builder

Database access, required to fetch configurations.

$languageTextManager : LanguageTextManager

Text manager to fetch error messages.

Return values
mixed

configuration()

Checks if given configuration is enabled.

public configuration(StringType $configField) : bool

Allowed fields are 'acceptPrivacy', 'optionalNames', 'splitStreetInformation'.

Parameters
$configField : StringType

Determines for which configuration field should be checked.

Return values
bool

True if configuration is enabled and false otherwise.

defaultStatusId()

Provides the default status id for customers and guests.

public defaultStatusId(StringType $configField) : int

Allowed fields are 'customer' and 'guest'.

Parameters
$configField : StringType

Either 'guest' or 'customer'.

Return values
int

Default status id of given config field.

display()

Should the provided configuration field be displayed? Allowed fields are 'gender', 'dob', 'dateOfBirth', 'company', 'state', 'telephone', 'fax', 'suburb'.

public display(StringType $configField) : bool
Parameters
$configField : StringType

Determines for which configuration field the display check should be performed.

Return values
bool

True if provided configuration field should be displayed and false otherwise.

errorMessage()

Error message for provided configuration field.

public errorMessage(StringType $configField) : string

Allowed fields are 'gender', 'firstName', 'lastName', 'dateOfBirth', 'company', 'vatNumber', 'email', 'emailAddressCheck', 'emailConfirmation', 'emailExists', 'street', 'houseNumber', 'postcode', 'city', 'country', 'countryZone', 'countryZoneSelection', 'telephone', 'password', 'passwordMismatch', 'privacy', 'invalidInput'.

Parameters
$configField : StringType

Determines for which configuration field the error message should be provided.

Return values
string

Error message of provided configuration field.

minLength()

Minimum length of provided configuration field.

public minLength(StringType $configField) : int

Allowed fields are 'firstName', 'lastName', 'dateOfBirth', 'dob', 'email', 'street', 'houseNumber', 'company', 'postcode', 'city', 'countryZone', 'suburb', 'state', 'telephone', 'password'.

Parameters
$configField : StringType

Determines for which configuration field the minimum length should be provided.

Return values
int

Minimum length of provided configuration field.

checkIfFieldExists()

Checks if given configuration field exists.

protected checkIfFieldExists(StringType $configField, array<string|int, mixed> $fields) : $this|CustomerConfigurationProvider
Parameters
$configField : StringType

Expected configuration field.

$fields : array<string|int, mixed>

Allowed configuration fields.

Tags
throws
InvalidArgumentException

If provided config field do not exist.

Return values
$this|CustomerConfigurationProvider

Same instance for chained method calls.

isConfigurationValueTrue()

Checks if the value is one of the different presentations of true from the different config table sources.

protected isConfigurationValueTrue( $configValue) : bool
Parameters
$configValue :

The tested config value

Return values
bool

True, if the value is meant to represent true.

Search results