本文整理汇总了PHP中Properties::addProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP Properties::addProperty方法的具体用法?PHP Properties::addProperty怎么用?PHP Properties::addProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Properties
的用法示例。
在下文中一共展示了Properties::addProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assignConfiguration
/**
* Stores the configuration. Calls the parent configuration first,
* then does additional operations.
*
* @param object Properties $configuration
* @return object
* @access public
* @since 3/24/05
*/
function assignConfiguration(Properties $configuration)
{
// Set the configuration values to our custom values.
$configuration->addProperty('authentication_table', 'auth_visitor');
$configuration->addProperty('username_field', 'email');
$configuration->addProperty('password_field', 'password');
$propertiesFields = array('name' => 'display_name', 'email' => 'email');
$configuration->addProperty('properties_fields', $propertiesFields);
try {
ArgumentValidator::validate($configuration->getProperty('email_from_name'), NonzeroLengthStringValidatorRule::getRule());
} catch (InvalidArgumentException $e) {
throw new ConfigurationErrorException("'email_from_name' must be a string. " . $e->getMessage());
}
try {
ArgumentValidator::validate($configuration->getProperty('email_from_address'), RegexValidatorRule::getRule('/^.+@.+$/'));
} catch (InvalidArgumentException $e) {
throw new ConfigurationErrorException("'email_from_address' must be an email address. " . $e->getMessage());
}
try {
ArgumentValidator::validate($configuration->getProperty('domain_blacklist'), OptionalRule::getRule(ArrayValidatorRuleWithRule::getRule(NonzeroLengthStringValidatorRule::getRule())));
ArgumentValidator::validate($configuration->getProperty('domain_whitelist'), OptionalRule::getRule(ArrayValidatorRuleWithRule::getRule(NonzeroLengthStringValidatorRule::getRule())));
} catch (InvalidArgumentException $e) {
throw new ConfigurationErrorException("'domain_blacklist' and 'domain_whitelist' if specified must be arrays of domain name strings. " . $e->getMessage());
}
parent::assignConfiguration($configuration);
}