当前位置: 首页>>代码示例>>PHP>>正文


PHP Validator::instance方法代码示例

本文整理汇总了PHP中Respect\Validation\Validator::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::instance方法的具体用法?PHP Validator::instance怎么用?PHP Validator::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Respect\Validation\Validator的用法示例。


在下文中一共展示了Validator::instance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Creates a new {@link LightInstruction}, verifying the action is valid and exactly two
  * coordinates have been given.
  *
  * @param int $action {@link LightInstructionAction}
  * @param Coordinate[] $coordinatePair two coordinates
  * @return LightInstruction
  * @throws \InvalidArgumentException
  */
 public static function create($action, array $coordinatePair)
 {
     v::oneOf(v::equals(LightInstructionAction::TURN_ON), v::equals(LightInstructionAction::TURN_OFF), v::equals(LightInstructionAction::TOGGLE))->check($action);
     v::length(2, 2)->check($coordinatePair);
     v::each(v::instance('\\Hamdrew\\AdventOfCode\\Day6\\Coordinate'))->check($coordinatePair);
     return new LightInstruction($action, $coordinatePair);
 }
开发者ID:hamdrew,项目名称:adventofcode,代码行数:16,代码来源:LightInstructionFactory.php

示例2: validate_items

 protected function validate_items($items)
 {
     $validator = Validator::instance($this->collection_of());
     foreach ($items as $item) {
         $this->assert()->is($validator, $item);
     }
 }
开发者ID:barryosull,项目名称:valueobjects,代码行数:7,代码来源:AbstractSet.php

示例3: __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

示例4: getValidationRules

 protected function getValidationRules()
 {
     v::with('app\\Models\\Validation\\');
     return [v::attribute('name', v::notEmpty()->alpha()->length(2, 100)->UniqueDimensionUOMName()), v::attribute('symbol', v::notEmpty()->alpha()->length(2, 2)->UniqueDimensionUOMSymbol()), v::attribute('routeTransaction', v::instance('app\\Models\\RouteTransaction')), v::attribute('statusId', v::notEmpty()->int()->positive()), v::attribute('createdAt', v::notEmpty()->date()), v::attribute('expiresAt', v::notEmpty()->date())];
 }
开发者ID:jamesvweston,项目名称:laravel-measurements,代码行数:5,代码来源:WeightConversion.php

示例5: sendBulkMessages

 /**
  * Send messages in bulk.
  *
  * @param  Message[] $messages
  * @param  array     $params
  *
  * @return mixed
  */
 public function sendBulkMessages(array $messages, array $params = null)
 {
     $sender = $this->createBulkSender();
     v::notEmpty()->setName("BulkSms Array")->check($messages);
     foreach ($messages as $message) {
         // make sure messages are proper objects
         v::instance('anlutro\\BulkSms\\Message')->check($message);
         $sender->addMessage($message);
     }
     if ($params) {
         $sender->setParams($params);
     }
     $response = $sender->send($this->testMode);
     $this->validateResponse($response);
     return $sender->extractResponse($response);
 }
开发者ID:roarkmccolgan,项目名称:php-bulk-sms,代码行数:24,代码来源:BulkSmsService.php

示例6: getValidationRules

 protected function getValidationRules()
 {
     v::with('app\\Models\\Validation\\');
     return [v::attribute('provider', v::oneOf(v::instance('app\\Models\\Provider'))), v::attribute('carrier', v::oneOf(v::instance('app\\Models\\Carrier'))), v::attribute('name', v::notEmpty()->length(3, 100)->alpha()->UniqueProviderName()), v::attribute('symbol', v::notEmpty()->length(3, 100)->UniqueProviderSymbol()), v::attribute('routeTransaction', v::instance('app\\Models\\RouteTransaction')), v::attribute('statusId', v::notEmpty()->int()->positive()), v::attribute('createdAt', v::notEmpty()->date()), v::attribute('expiresAt', v::notEmpty()->date())];
 }
开发者ID:jamesvweston,项目名称:laravel-measurements,代码行数:5,代码来源:TaxType.php

示例7: logDate

 /**
  *
  * @param \DateTime $logDate
  * @return boolean
  */
 public function logDate($logDate) : bool
 {
     return V::instance('DateTime')->validate($logDate);
 }
开发者ID:ignaszak,项目名称:cms,代码行数:9,代码来源:Validation.php


注:本文中的Respect\Validation\Validator::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。