本文整理汇总了PHP中ArgumentValidator::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP ArgumentValidator::validate方法的具体用法?PHP ArgumentValidator::validate怎么用?PHP ArgumentValidator::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArgumentValidator
的用法示例。
在下文中一共展示了ArgumentValidator::validate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDisplayName
/**
* Sets the display name of this menu item.
* @access public
* @param string text The new display name.
**/
function setDisplayName($text)
{
// ** parameter validation
ArgumentValidator::validate($text, StringValidatorRule::getRule(), true);
// ** end of parameter validation
$this->_text = $text;
}
示例2: createComponentForPartStructure
/**
* Create a new PrimitiveIO object that allows for selection from an authority
* list
*
* @param <##>
* @return <##>
* @access public
* @since 5/1/06
*/
static function createComponentForPartStructure($partStruct)
{
ArgumentValidator::validate($partStruct, ExtendsValidatorRule::getRule("PartStructure"));
$partStructType = $partStruct->getType();
// get the datamanager data type
$dataType = $partStructType->getKeyword();
// printpre($dataType);
$authoritativeValues = $partStruct->getAuthoritativeValues();
if ($authoritativeValues->hasNext()) {
$authZManager = Services::getService("AuthZ");
$idManager = Services::getService("Id");
if ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify_authority_list"), $partStruct->getRepositoryId())) {
$component = new PrimitiveIO_AuthoritativeContainer();
$component->setSelectComponent(PrimitiveIOManager::createAuthoritativeComponent($dataType));
$component->setNewComponent(PrimitiveIOManager::createComponent($dataType));
} else {
$component = PrimitiveIOManager::createAuthoritativeComponent($dataType);
}
while ($authoritativeValues->hasNext()) {
$component->addOptionFromSObject($authoritativeValues->next());
}
} else {
// get the simple component for this data type
$component = PrimitiveIOManager::createComponent($dataType);
}
return $component;
}
示例3: __construct
/**
* Constructor
*
* @param object XmlSiteDirector $director
* @param object DOMElement $element
* @return object XmlSiteNavBlockSiteComponent
* @access public
* @since 4/3/06
*/
function __construct(AssetSiteDirector $director, Asset $asset, $element)
{
ArgumentValidator::validate($element, OptionalRule::getRule(ExtendsValidatorRule::getRule('DOMElement')));
$this->_director = $director;
$this->_asset = $asset;
$this->_element = $element;
}
示例4: HarmoniReadableLog
/**
* Constructor
*
* @param string $name
* @return object
* @access public
* @since 3/1/06
*/
function HarmoniReadableLog($name, $dbIndex)
{
ArgumentValidator::validate($name, StringValidatorRule::getRule());
ArgumentValidator::validate($dbIndex, IntegerValidatorRule::getRule());
$this->_name = $name;
$this->_dbIndex = $dbIndex;
}
示例5: __construct
/**
* Constructor.
*
* @param string $baseName A name for the file.
* @param optional DateAndTime $timestamp The Modification date/time
* @return null
* @access public
* @since 5/6/08
*/
public function __construct($baseName, DateAndTime $timestamp = null)
{
ArgumentValidator::validate($baseName, NonzeroLengthStringValidatorRule::getRule());
$this->baseName = $baseName;
$this->contents = '';
$this->timestamp = $timestamp;
}
示例6: setDisplayName
/**
* Sets the display name of this menu item.
* @access public
* @param string displayName The new display name.
**/
function setDisplayName($displayName)
{
// ** parameter validation
ArgumentValidator::validate($displayName, StringValidatorRule::getRule(), true);
// ** end of parameter validation
$this->_displayName = $displayName;
}
示例7: __construct
/**
* Constructor. Sign up for reCAPTCHA keys at http://recaptcha.net/
*
* @param string $publicKey
* @param string $privateKey
* @return void
* @access public
* @since 6/4/08
*/
public function __construct($publicKey, $privateKey)
{
ArgumentValidator::validate($publicKey, NonzeroLengthStringValidatorRule::getRule());
ArgumentValidator::validate($privateKey, NonzeroLengthStringValidatorRule::getRule());
$this->_publicKey = $publicKey;
$this->_privateKey = $privateKey;
}
示例8: PersistentOrderedSet
/**
* Constructor.
* @param object Id $setId The Id of this set.
* @param integer $dbIndex The index of the database connection which has
* tables in which to store the set.
*/
function PersistentOrderedSet($setId, $dbIndex)
{
parent::OrderedSet($setId);
ArgumentValidator::validate($dbIndex, IntegerValidatorRule::getRule(), true);
// Create our internal array
$this->_dbIndex = $dbIndex;
// populate our array with any previously stored items.
$query = new SelectQuery();
$query->addColumn("item_order", "item_order");
$query->addColumn("item_id", "item_id");
$query->addTable("sets");
$query->addWhere("id = '" . addslashes($this->_setId->getIdString()) . "'");
$query->addOrderBy("item_order");
$dbHandler = Services::getService("DatabaseManager");
$result = $dbHandler->query($query, $this->_dbIndex);
$i = 0;
$oldItems = array();
while ($result->hasMoreRows()) {
// Add the items to our array
$this->_items[$i] = $result->field("item_id");
// Store an array of the order-key/value relationships to reference
// when updating any inconsistancies in order numbering.
$oldItems[$result->field("item_order")] = $result->field("item_id");
$i++;
$result->advanceRow();
}
$result->free();
// Make sure that we have our set is filled from 0 to count()
reset($oldItems);
$this->_updateOrders($oldItems);
}
示例9: FromNodesAssetIterator
/**
* Constructor
*
* @param object NodeIterator $nodes
* @param object Repository $repository
* @return object
* @access public
* @since 5/4/06
*/
function FromNodesAssetIterator($nodes, $repository)
{
// ArgumentValidator::validate($nodes, ExtendsValidatorRule::getRule("Iterator"));
ArgumentValidator::validate($repository, ExtendsValidatorRule::getRule("Repository"));
$this->_nodes = $nodes;
$this->_repository = $repository;
}
示例10: MenuItemLinkWithAdditionalHtml
/**
* The constructor.
* @param string displayName The display name of this menu item.
* @param string url The url of this menu item.
* @param boolean selected The selected state of this menu item.
* @param integer index The index of this component. The index has no semantic meaning:
* you can think of the index as 'level' of the component. Alternatively,
* the index could serve as means of distinguishing between components with
* the same type. Most often one would use the index in conjunction with
* the <code>getStylesForComponentType()</code> and
* <code>addStyleForComponentType()</code> methods.
* @param string target The target window of this menu item.
* @param string accessKey The access key (shortcut) of this menu item.
* @param string toolTip The toolTip of this menu item.
* @access public
**/
function MenuItemLinkWithAdditionalHtml($displayName, $url, $selected, $index, $target = null, $accessKey = null, $toolTip = null, $additionalHtml = '')
{
ArgumentValidator::validate($additionalHtml, StringValidatorRule::getRule());
// ** end of parameter validation
$this->_additionalHtml = $additionalHtml;
$this->MenuItemLink($displayName, $url, $selected, $index, $target, $accessKey, $toolTip);
}
示例11: updateDisplayName
function updateDisplayName($newDisplayName)
{
//make sure its a string
ArgumentValidator::validate($newDisplayName, new StringValidatorRule(), true);
//set the display name in the object
$this->getNode()->updateDisplayName($newDisplayName);
}
示例12: HarmoniEntry
/**
* Constructor
*
* @param mixed $entryItem
* @param object Type $formatType
* @param object Type $priorityType
* @return object
* @access public
* @since 3/1/06
*/
function HarmoniEntry($timestamp, $category, $description, $backtrace, $agents, $nodes, $formatType, $priorityType)
{
ArgumentValidator::validate($timestamp, ExtendsValidatorRule::getRule("DateAndTime"));
ArgumentValidator::validate($category, StringValidatorRule::getRule());
ArgumentValidator::validate($description, StringValidatorRule::getRule());
ArgumentValidator::validate($backtrace, StringValidatorRule::getRule());
ArgumentValidator::validate($agents, ArrayValidatorRule::getRule());
ArgumentValidator::validate($nodes, ArrayValidatorRule::getRule());
ArgumentValidator::validate($formatType, ExtendsValidatorRule::getRule("Type"));
ArgumentValidator::validate($priorityType, ExtendsValidatorRule::getRule("type"));
$this->_timestamp = $timestamp;
$this->_formatType = $formatType;
$this->_priorityType = $priorityType;
$this->_entryItem = new AgentNodeEntryItem($category, $description);
$this->_entryItem->setBacktrace($backtrace);
$idManager = Services::getService("Id");
foreach ($agents as $idString) {
if ($idString) {
$this->_entryItem->addAgentId($idManager->getId($idString));
}
}
foreach ($nodes as $idString) {
if ($idString) {
$this->_entryItem->addNodeId($idManager->getId($idString));
}
}
}
示例13: __construct
/**
* Constructor.
*
* @param string $path
* @return null
* @access public
* @since 5/6/08
*/
public function __construct($path)
{
ArgumentValidator::validate($path, NonzeroLengthStringValidatorRule::getRule());
if (!file_exists($path) || is_dir($path)) {
throw new InvalidArgumentException("'" . $path . "' is not a valid file.", 78345);
}
$this->path = $path;
}
示例14: addSQLQuery
/**
* Adds one SQL string to this query.
* @access public
* @param string sql One SQL string,
* @return void
*/
function addSQLQuery($sql)
{
// ** parameter validation
$stringRule = StringValidatorRule::getRule();
ArgumentValidator::validate($sql, $stringRule, true);
// ** end of parameter validation
$this->_sql[] = $sql;
}
示例15: addDataType
/**
* Adds a specific data type (identified by a string such as "integer") to our registry. Each data type has two classes associated with it: a {@link Primitive} and a {@link StorablePrimitive}. The former is used when setting/getting values, the latter used when talking with the database.
* @param string $typeName The name (such as "integer" or "boolean") of this new data type.
* @param string $primitiveClass The name of the {@link Primitive} class.
* @param string $storablePrimitiveClass The name of the {@link StorablePrimitive} class.
* @param string $conversionMethod
* @access public
* @return void
*/
function addDataType($typeName, $primitiveClass, $storablePrimitiveClass, $conversionMethod)
{
ArgumentValidator::validate($conversionMethod, StringValidatorRule::getRule());
$this->_registeredTypes[$typeName] = array("primitive" => $primitiveClass, "storable" => $storablePrimitiveClass, "ConversionMethod" => $conversionMethod);
if (!in_array(strtolower($storablePrimitiveClass), $this->_primitiveClassMapping)) {
$this->_primitiveClassMapping[] = strtolower($storablePrimitiveClass);
}
}