本文整理汇总了PHP中Respect\Validation\Validator::in方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::in方法的具体用法?PHP Validator::in怎么用?PHP Validator::in使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Respect\Validation\Validator
的用法示例。
在下文中一共展示了Validator::in方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateForm
private function validateForm($data)
{
$l = Movim\i18n\Locale::start();
if (Validator::in(array_keys($l->getList()))->validate($data['language']) && Validator::in(array('show', 'hide'))->validate($data['roster']) && ($data['cssurl'] == '' || Validator::url()->validate($data['cssurl']))) {
return true;
}
return false;
}
示例2: ajaxVcardSubmit
function ajaxVcardSubmit($vcard)
{
# Format it ISO 8601:
if ($vcard->year->value != -1 && $vcard->month->value != -1 && $vcard->day->value != -1) {
$vcard->date->value = $vcard->year->value . '-' . $vcard->month->value . '-' . $vcard->day->value;
}
unset($vcard->year->value);
unset($vcard->month->value);
unset($vcard->day->value);
$cd = new \Modl\ContactDAO();
$c = $cd->get($this->user->getLogin());
if ($c == null) {
$c = new \Modl\Contact();
}
$c->jid = $this->user->getLogin();
if (isset($vcard->date->value)) {
$c->date = $vcard->date->value;
}
if (Validator::string()->length(0, 40)->validate($vcard->name->value)) {
$c->name = $vcard->name->value;
}
if (Validator::string()->length(0, 40)->validate($vcard->fn->value)) {
$c->fn = $vcard->fn->value;
}
if (Validator::url()->validate($vcard->url->value)) {
$c->url = $vcard->url->value;
}
if (Validator::in(array_keys(getGender()))->validate($vcard->gender->value)) {
$c->gender = $vcard->gender->value;
}
if (Validator::in(array_keys(getMarital()))->validate($vcard->marital->value)) {
$c->marital = $vcard->marital->value;
}
$c->adrlocality = $vcard->locality->value;
$c->adrcountry = $vcard->country->value;
if (Validator::email()->validate($vcard->email->value)) {
$c->email = $vcard->email->value;
}
$c->twitter = $vcard->twitter->value;
$c->skype = $vcard->skype->value;
$c->yahoo = $vcard->yahoo->value;
if (Validator::string()->validate($vcard->desc->value)) {
$c->description = trim($vcard->desc->value);
}
$cd = new \Modl\ContactDAO();
$cd->set($c);
$r = new Set();
$r->setData($c)->request();
$r = new Moxl\Xec\Action\Vcard\Set();
$r->setData($vcard)->request();
}
示例3: setIndicador
/**
* Indicador do código de segurança:
*
* 0 (não informado)
* 1 (informado)
* 2 (ilegível)
* 9 (inexistente)
*
* @var integer
* @return Cartao
*/
public function setIndicador($indicador)
{
if (!v::in(array(0, 1, 2, 9), true)->validate($indicador)) {
throw new InvalidArgumentException('Indicador de código de segurança inválido.');
}
$this->indicador = (int) $indicador;
return $this;
}
示例4: postValidator
private function postValidator($post = array())
{
try {
v::stringType()->notEmpty()->length(1, 20)->assert($post['name']);
v::in(['Y', 'N'])->assert($post['enable']);
} catch (vn $exception) {
$this->MSG->showmsg(nl2br($exception->getFullMessage()));
}
}
示例5: __construct
public function __construct(Client $client)
{
$this->client = $client;
$sortColumns = array_keys(Bookmark::select()->toAssoc());
$this->supportedSettings = array('ff.limit' => array('desc' => 'Limit amount of results (> 0 or 0 for no limit)', 'validation' => array(v::int()->min(0, true)), 'default' => '0'), 'ff.sort' => array('desc' => 'Sort order of results (' . implode($sortColumns, ', ') . ')', 'validation' => array(v::in($sortColumns)->notEmpty()), 'default' => 'hit_count'), 'ff.interactive' => array('desc' => 'Ask for missing input interactively (0 never, 1 always)', 'validation' => array(v::in(array('0', '1'))), 'default' => '1'), 'ff.color' => array('desc' => 'Enable color output on supported systems (0/1)', 'validation' => array(v::in(array('0', '1'))), 'default' => '1'));
}
示例6: role
/**
*
* @param string $role
* @return boolean
*/
public function role($role) : bool
{
return V::in(['admin', 'moderator', 'user'])->validate($role);
}
示例7: setDuplicateCheck
/**
* @param string $value
*/
public function setDuplicateCheck($value)
{
$validator = Validator::in(['DUPLIST', 'DUPCAMP', 'DUPSYS', 'DUPTITLEALTPHONELIST', 'DUPTITLEALTPHONECAMP', 'DUPTITLEALTPHONESYS', 'DUPNAMEPHONELIST', 'DUPNAMEPHONECAMP', 'DUPNAMEPHONESYS']);
if ($validator->validate($value)) {
$this->setProperty('duplicate_check', $value);
}
}