本文整理汇总了PHP中Assert::isNotEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::isNotEmpty方法的具体用法?PHP Assert::isNotEmpty怎么用?PHP Assert::isNotEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert
的用法示例。
在下文中一共展示了Assert::isNotEmpty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param array of string $fields
*/
function __construct($name, DBTable $table, array $fields)
{
Assert::isScalar($name);
Assert::isNotEmpty($fields, 'constraint cannot be across zero fields');
$this->name = $name;
$this->table = $table;
$this->fields = $fields;
}
示例2: getSelectedValues
/**
* Gets the list of imported/default values
* @return array
*/
function getSelectedValues()
{
Assert::isNotEmpty($this->ids, 'options not yet set');
$value = $this->getValue();
if ($value) {
return array($value);
} else {
return array();
}
}
示例3: authenticate
/**
* Perform the authorisation request
* @return DbAuth
*/
public function authenticate()
{
$credential = $this->getCredential();
Assert::isNotEmpty($credential, "You must set a password before authentication");
$identity = $this->getIdentity();
Assert::isNotEmpty($identity, "You must set an username before authentication");
//We first get user from db if its exists
$criteria = new Criteria(Restriction::is($this->identityColumn, $identity));
$records = TableGateway::loadMatching($this->table, $criteria);
if ($records->count() == 0) {
return false;
}
/** @var $user Customer */
$user = $records->current();
//Yes we need to reassign this to variable.
$credentialColumn = $this->credentialColumn;
$credentialSaltColumn = $this->credentialSaltColumn;
$slatedCredentialColumn = $this->slatedCredentialColumn;
//We check if we should use salt checking
if (!empty($credentialSaltColumn) && !empty($slatedCredentialColumn) && !empty($user->{$credentialSaltColumn}) && !empty($user->{$slatedCredentialColumn})) {
//Fo salt we check if password is same like credential
$authenticated = SaltPasswordManager::checkPasswordWithHash($user->{$slatedCredentialColumn}, $user->{$credentialSaltColumn}, $this->credential);
} else {
//If don't have salt we must check if we have hashed password
if ($this->hash) {
$credential = SaltPasswordManager::generateSimpleHash($this->credential);
} else {
$credential = $this->credential;
}
//We check if we are authenticated
$authenticated = $credential == $user->{$credentialColumn};
/**
* If we are authenticated and have original password, we can create and add slated password for user and
* we should do it. It means we are not Auto Login or something.
*/
if ($authenticated && $this->hash) {
if (!empty($credentialSaltColumn) && !empty($slatedCredentialColumn)) {
list($password, $hash) = SaltPasswordManager::generateSaltedPassword($this->credential);
$this->addSalt($user, $password, $hash);
}
}
}
if (empty($authenticated)) {
return false;
}
return $this->authorisedId = $records->current()->__get($this->identityKey);
}
示例4: checkMemberIndependency
/**
* @return void
*/
private function checkMemberIndependency(array $members)
{
$thrashed = array_unique($members);
if (sizeof($thrashed) != sizeof($members)) {
$duplicates = $this->getDuplicates($members);
Assert::isNotEmpty($duplicates, 'core error: duplicates not found');
Assert::isUnreachable('%s %s enumeration constants has the same value %s', join($duplicates, ', '), get_class($this), $members[reset($duplicates)]);
}
}
示例5: getById
public function getById($id, $expires = Cache::EXPIRES_MEDIUM)
{
Assert::isScalar($id);
Assert::isNotEmpty($id);
if (isset($this->identityMap[$id])) {
return $this->identityMap[$id];
}
return $this->addObjectToMap(Cache::worker($this)->getById($id, $expires));
}
示例6: __construct
function __construct($name, $label)
{
Assert::isNotEmpty($label, 'label should be specified');
parent::__construct($name, $label, $label);
}
示例7: toString
/**
* @param Model $model
* @return string
*/
public function toString($model = null)
{
Assert::isNotEmpty($this->callback, 'callback can not be empty!');
$json = parent::toString($model);
return $this->callback . '(' . $json . ');';
}
示例8: getSelfHref
/**
* Gets the text representastion of the requested URL
*
* @return string
*/
function getSelfHref()
{
Assert::isNotEmpty($this->trace, 'trace is not set');
return $this->trace->getWebContext()->getRequest()->getHttpUrl()->getUri();
}
示例9: getTagId
protected function getTagId()
{
Assert::isNotEmpty($this->tagId, sprintf('Your descendant %s should call %s::__construct() to initialize the object', get_class($this), __CLASS__));
return $this->tagId;
}