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


PHP AbstractValidator::__construct方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * @param array|callable $options
  */
 public function __construct($options = null)
 {
     if (is_callable($options)) {
         $options = ['callback' => $options];
     }
     parent::__construct($options);
 }
开发者ID:MadCat34,项目名称:zend-validator,代码行数:12,代码来源:Callback.php

示例2: __construct

 /**
  * Do our own constructor so we can check for the php-clamav library
  * @param \Foundation\Form\Element $e the element we are validating
  * @param integer $sizeInBytes
  */
 public function __construct(\Foundation\Form\Element $element)
 {
     if (!extension_loaded('clamav') or !function_exists('cl_scanfile')) {
         throw new \Foundation\Exception("Virusscan validator requires the php-clamav extension.");
     }
     parent::__construct($element);
 }
开发者ID:jazzee,项目名称:foundation,代码行数:12,代码来源:Virusscan.php

示例3: __construct

 /**
  * Construct
  * Check the ruleSet
  *
  * @param \Foundation\Form\Element $e
  * @param mixed $ruleSet
  */
 public function __construct(\Foundation\Form\Element $e, $ruleSet)
 {
     if (\is_null($ruleSet)) {
         throw new \Foundation\Exception("The ruleset for SpeicifcString must be set.");
     }
     parent::__construct($e, $ruleSet);
 }
开发者ID:jazzee,项目名称:foundation,代码行数:14,代码来源:SpecificString.php

示例4: __construct

 /**
  * Construct 
  * Check the ruleSet
  * 
  * @param \Foundation\Form\Element $e
  * @param mixed $ruleSet
  */
 public function __construct(\Foundation\Form\Element $e, $ruleSet)
 {
     if (!\strtotime($ruleSet)) {
         throw new \Foundation\Exception("The ruleset for DateBefore must be a valid PHP date string");
     }
     parent::__construct($e, $ruleSet);
 }
开发者ID:jazzee,项目名称:foundation,代码行数:14,代码来源:DateBefore.php

示例5: __construct

 /**
  * Construct 
  * Check the ruleSet
  * @param \Foundation\Form\Element $e
  * @param mixed $ruleSet
  */
 public function __construct(\Foundation\Form\Element $e, $ruleSet)
 {
     if (!\is_array($ruleSet) or !isset($ruleSet[0]) or !isset($ruleSet[1])) {
         throw new \Foundation\Exception("The ruleset for NumberRange must be an array with two elements.");
     }
     parent::__construct($e, $ruleSet);
 }
开发者ID:jazzee,项目名称:foundation,代码行数:13,代码来源:NumberRange.php

示例6: __construct

 /**
  * Construct 
  * Check the ruleSet
  * @param \Foundation\Form\Element $e
  * @param mixed $ruleSet
  */
 public function __construct(\Foundation\Form\Element $e, $ruleSet)
 {
     if (!\is_int($ruleSet)) {
         throw new \Foundation\Exception("The ruleset for MaximumLength must be an integer");
     }
     parent::__construct($e, $ruleSet);
 }
开发者ID:jazzee,项目名称:foundation,代码行数:13,代码来源:MaximumLength.php

示例7: __construct

 /**
  * @param null $options - expects to find a ['token'] entry in
  * options, with the token in it
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setMessage(self::MsgInvalidToken, 'Unable to authenticate form data. Please refresh and try again.');
     $this->token = isset($options['token']) ? $options['token'] : 'missing token';
     $this->logger = isset($options['logger']) ? $options['logger'] : null;
 }
开发者ID:rikh42,项目名称:band-snb,代码行数:11,代码来源:CsrfValidator.php

示例8: __construct

 /**
  * Do our own constructor so we can set the maxfilesize and check the ruleSet
  * @param \Foundation\Form\Element $e the element we are validating
  * @param integer $sizeInBytes
  */
 public function __construct(\Foundation\Form\Element $element, $sizeInBytes)
 {
     if (!($integer = \intval($sizeInBytes))) {
         throw new \Foundation\Exception("The ruleset for MaximumFileSize must be an integer. Value: '{$sizeInBytes}'");
     }
     parent::__construct($element, $integer);
     $this->e->setMaxSize($this->ruleSet);
 }
开发者ID:jazzee,项目名称:foundation,代码行数:13,代码来源:MaximumFileSize.php

示例9: __construct

 /**
  * Constructs the validator, initializing the regular expression.
  *
  * @param \Zikula_ServiceManager $serviceManager    The current service manager instance.
  * @param string                 $regularExpression The PCRE regular expression against which to validate the data.
  * @param string                 $errorMessage      The error message to return if the data does not match the expression.
  *
  * @throws \InvalidArgumentException Thrown if the regular expression is not valid.
  */
 public function __construct(\Zikula_ServiceManager $serviceManager, $regularExpression, $errorMessage = null)
 {
     parent::__construct($serviceManager, $errorMessage);
     if (!isset($regularExpression) || !is_string($regularExpression) || empty($regularExpression)) {
         throw new \InvalidArgumentException($this->__('An invalid regular expression was received.'));
     }
     $this->regularExpression = $regularExpression;
 }
开发者ID:Silwereth,项目名称:core,代码行数:17,代码来源:StringRegularExpression.php

示例10: __construct

 /**
  * Constructs a new validator, initializing the minimum valid value.
  *
  * @param \Zikula_ServiceManager $serviceManager The current service manager instance.
  * @param integer                $value          The minimum valid value for the field data.
  * @param string                 $errorMessage   The error message to return if the field data is not valid.
  *
  * @throws \InvalidArgumentException If the minimum value specified is not an integer.
  */
 public function __construct(\Zikula_ServiceManager $serviceManager, $value, $errorMessage = null)
 {
     parent::__construct($serviceManager, $errorMessage);
     if (!isset($value) || !is_int($value) || $value < 0) {
         throw new \InvalidArgumentException($this->__('An invalid integer value was received.'));
     }
     $this->value = $value;
 }
开发者ID:rmaiwald,项目名称:core,代码行数:17,代码来源:IntegerNumericMinimumValue.php

示例11: __construct

 /**
  * Constructs a new validator, initializing the maximum valid string length value.
  *
  * @param \Zikula_ServiceManager $serviceManager The current service manager instance.
  * @param integer                $length         The maximum valid length for the string value.
  * @param string                 $errorMessage   The error message to return if the string data exceeds the maximum length.
  *
  * @throws \InvalidArgumentException Thrown if the maximum string length value is not an integer or is less than zero.
  */
 public function __construct(\Zikula_ServiceManager $serviceManager, $length, $errorMessage = null)
 {
     parent::__construct($serviceManager, $errorMessage);
     if (!isset($length) || !is_int($length) || $length < 0) {
         throw new \InvalidArgumentException($this->__('An invalid string length was received.'));
     }
     $this->length = $length;
 }
开发者ID:Silwereth,项目名称:core,代码行数:17,代码来源:StringMaximumLength.php

示例12: __construct

 /**
  * @param string $allowedTags
  */
 public function __construct(...$allowedValues)
 {
     parent::__construct();
     if (!$allowedValues) {
         throw new \InvalidArgumentException('__construct() expects at least 1 parameter');
     }
     $this->allowedValues = $allowedValues;
 }
开发者ID:gobline,项目名称:filter,代码行数:11,代码来源:Value.php

示例13: __construct

 public function __construct($pattern)
 {
     if (is_string($pattern)) {
         $this->setPattern($pattern);
         parent::__construct(array());
         return;
     }
     parent::__construct($pattern);
 }
开发者ID:musicsnap,项目名称:Yaf.Global.Library,代码行数:9,代码来源:Regex.php

示例14: __construct

 /**
  * Constructor for barcodes
  *
  * @param array|string $options Options to use
  */
 public function __construct($options = null)
 {
     if (!is_array($options) && !$options instanceof \Zend\Config\Config) {
         $options = array('adapter' => $options);
     }
     if (array_key_exists('options', $options)) {
         $options['options'] = array('options' => $options['options']);
     }
     parent::__construct($options);
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:15,代码来源:Barcode.php

示例15: __construct

 /**
  * @param int|float|string $min
  * @param int|float|string $max
  */
 public function __construct($min, $max)
 {
     parent::__construct();
     $this->min = $min;
     $this->max = $max;
     if (is_string($min) && !is_numeric($min) && is_string($max) && !is_numeric($max)) {
         $this->isStringComparison = true;
     } else {
         $this->min = (double) $this->min;
         $this->max = (double) $this->max;
     }
 }
开发者ID:gobline,项目名称:filter,代码行数:16,代码来源:Between.php


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