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


PHP Validator::oneOf方法代码示例

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


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

 public function providerForInvalidNot()
 {
     return [[new IntVal(), 123], [new AllOf(new OneOf(new NumericVal(), new IntVal())), 13.37], [new OneOf(new NumericVal(), new IntVal()), 13.37], [Validator::oneOf(Validator::numericVal(), Validator::intVal()), 13.37]];
 }
开发者ID:respect,项目名称:validation,代码行数:4,代码来源:NotTest.php

示例3: validate

 private function validate()
 {
     try {
         $validator = v::attribute('merchantAlias', v::stringType()->alnum('_')->noWhitespace()->length(1, 30))->attribute('macKey', v::stringType()->length(1))->attribute('transactionCode', v::stringType()->alnum()->noWhitespace()->length(1, 30))->attribute('requestType', v::oneOf(v::stringType()->equals(self::REQUEST_TYPE_FIRST_ATTEMPT), v::stringType()->equals(self::REQUEST_TYPE_RETRY_ATTEMPT)))->attribute('operationId', v::stringType()->digit()->noWhitespace()->length(1, 10))->attribute('operationType', v::oneOf(v::stringType()->equals(self::OPERATION_TYPE_CAPTURE), v::stringType()->equals(self::OPERATION_TYPE_VOID)))->attribute('originalAmount', v::stringType()->digit()->noWhitespace()->length(9, 9))->attribute('currency', v::stringType()->alnum()->noWhitespace()->length(3, 3))->attribute('authCode', v::stringType()->alnum()->noWhitespace()->length(1, 10))->attribute('operationAmount', v::stringType()->digit()->noWhitespace()->length(9, 9))->attribute('user', v::optional(v::stringType()->alnum()->length(0, 20)))->attribute('isTest', v::boolType());
         $validator->assert($this);
     } catch (NestedValidationException $e) {
         throw new ValidationException($e->getFullMessage());
     }
 }
开发者ID:webgriffe,项目名称:lib-quipago,代码行数:9,代码来源:EcRequest.php

示例4: providerForInvalidNot

 public function providerForInvalidNot()
 {
     return array(array(new IntVal(), 123), array(new AllOf(new OneOf(new Numeric(), new IntVal())), 13.37), array(new OneOf(new Numeric(), new IntVal()), 13.37), array(Validator::oneOf(Validator::numeric(), Validator::intVal()), 13.37));
 }
开发者ID:jinjiang2009,项目名称:Validation,代码行数:4,代码来源:NotTest.php

示例5: max

 public static function max($details, $value)
 {
     return RespectValidator::oneOf(RespectValidator::int()->max((int) $details), RespectValidator::int()->equals((int) $details))->validate($value);
 }
开发者ID:tohir,项目名称:formgenerator,代码行数:4,代码来源:formclass.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


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