當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Validator::arrayVal方法代碼示例

本文整理匯總了PHP中Respect\Validation\Validator::arrayVal方法的典型用法代碼示例。如果您正苦於以下問題:PHP Validator::arrayVal方法的具體用法?PHP Validator::arrayVal怎麽用?PHP Validator::arrayVal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Respect\Validation\Validator的用法示例。


在下文中一共展示了Validator::arrayVal方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validateConfig

 private function validateConfig(array $config)
 {
     if (empty($config)) {
         throw new \InvalidArgumentException('Empty config is not allowed');
     }
     $validator = v::arrayVal()->notEmpty()->key('search', v::arrayVal()->notEmpty()->key('uri', v::url()->notEmpty())->key('key', v::alnum()->notEmpty()))->key('data', v::arrayVal()->notEmpty()->key('uri', v::url()->notEmpty())->key('key', v::alnum()->notEmpty()));
     $validator->assert($config);
 }
開發者ID:dafiti,項目名稱:datajet-client,代碼行數:8,代碼來源:Product.php

示例2: __construct

 public function __construct(array $options)
 {
     $options = ['baseUri' => Arr::get($options, 'baseUri', $this->baseUri), 'timeout' => Arr::get($options, 'timeout', $this->timeout), 'proxy' => Arr::get($options, 'proxy', $this->proxy), 'auth' => Arr::get($options, 'auth', $this->auth), 'logger' => Arr::get($options, 'logger')];
     try {
         V::arrayVal()->key('baseUri', V::url()->notEmpty())->key('timeout', V::floatVal()->min(0))->key('proxy', V::optional(V::url()))->key('auth', V::arrayVal()->key('user', V::stringType())->key('pass', V::stringType()))->key('logger', V::instance('\\Psr\\Log\\LoggerInterface'))->assert($options);
     } catch (\InvalidArgumentException $e) {
         $errors = array_filter($e->findMessages(['baseUri' => 'Required correct baseUri', 'timeout' => 'Required correct timeout', 'proxy' => 'Required correct proxy', 'auth' => 'Required correct authuser', 'logger' => 'Required a logger instance of psr\\log']));
         $errmsg = array_shift($errors);
         throw new Exception($errmsg);
     }
     $this->baseUri = $options['baseUri'];
     $this->timeout = $options['timeout'];
     $this->proxy = $options['proxy'];
     $this->auth = $options['auth'];
     $this->logger = $options['logger'];
 }
開發者ID:qinyuguang,項目名稱:libyaf,代碼行數:16,代碼來源:Conf.php


注:本文中的Respect\Validation\Validator::arrayVal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。