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


PHP Validators::isInRange方法代码示例

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


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

示例1: getMessage

 /**
  * Get status code from response
  * @param string $response Response
  * @return string Status message
  */
 public function getMessage($response)
 {
     if ($response == 'OK') {
         return 'OK';
     } else {
         if (Strings::startsWith($response, 'ERROR ') && Validators::isInRange(explode(' ', $response)[1], [1, 18])) {
             return explode(';', $response)[1];
         } else {
             throw new \InvalidArgumentException('Invalid response');
         }
     }
 }
开发者ID:roman3349,项目名称:iqrf-cloud-nette,代码行数:17,代码来源:Status.php

示例2: getSettings

 /**
  * @throws ImageStorageException
  * @return array
  */
 public function getSettings()
 {
     if (!$this->settings) {
         $config = $this->validateConfig($this->defaults);
         $config['wwwDir'] = Nette\DI\Helpers::expand($config['wwwDir'], $this->getContainerBuilder()->parameters);
         // Validation
         $quality = $config['quality'];
         if (!is_int($quality) || !Validators::isInRange($quality, [0, 100])) {
             throw new ImageStorageException('Quality must be an integer from 0 to 100.');
         }
         foreach ($config['events'] as $name => &$array) {
             Validators::assert($array, 'array');
         }
         foreach ($config['helpers'] as $name => $class) {
             if (!class_exists($class) || $class instanceof IHelper) {
                 throw new ImageStorageException("Helper {$name} must be instance of " . IHelper::class);
             }
         }
         $this->settings = $config;
     }
     return $this->settings;
 }
开发者ID:webchemistry,项目名称:images,代码行数:26,代码来源:ImagesExtension.php

示例3: validateLength

 /**
  * Count/length validator. Range is array, min and max length pair.
  * @return bool
  */
 public static function validateLength(IControl $control, $range)
 {
     if (!is_array($range)) {
         $range = array($range, $range);
     }
     $value = $control->getValue();
     return Validators::isInRange(is_array($value) ? count($value) : Strings::length($value), $range);
 }
开发者ID:rostenkowski,项目名称:nette,代码行数:12,代码来源:Validator.php

示例4: validateRange

 /**
  * Rangle validator: is a control's value number in specified range?
  * @param  TextBase
  * @param  array  min and max value pair
  * @return bool
  */
 public static function validateRange(TextBase $control, $range)
 {
     return Validators::isInRange($control->getValue(), $range);
 }
开发者ID:ppwalks33,项目名称:cleansure,代码行数:10,代码来源:TextBase.php

示例5: validateRange

 /**
  * Rangle validator: is a control's value number in specified range?
  * @param  Nette\Forms\IControl
  * @param  array  min and max value pair
  * @return bool
  */
 public static function validateRange(IControl $control, $range)
 {
     return Nette\Utils\Validators::isInRange($control->getValue(), $range);
 }
开发者ID:radeksimko,项目名称:nette,代码行数:10,代码来源:BaseControl.php

示例6: validateRange

 /**
  * @param UploadControl $control
  * @param $range
  * @return bool
  */
 public static function validateRange(UploadControl $control, $range)
 {
     $files = count($control->getValue());
     return Validators::isInRange($files, $range);
 }
开发者ID:f3l1x,项目名称:nette-plugins,代码行数:10,代码来源:MultiUploadControl.php

示例7: isDateInRange

 /**
  * kontrola datumu v rozsahu
  * @param  [type]  $from  od
  * @param  [type]  $to    do
  * @param  [type]  $value now
  * @return boolean        [description]
  */
 public static function isDateInRange($from, $to, $value = null)
 {
     $d1 = new \DateTime($from);
     $d2 = new \DateTime($to);
     $now = new \DateTime($value);
     if ($from && $to) {
         return \Nette\Utils\Validators::isInRange($now, array($d1, $d2));
     }
     return false;
 }
开发者ID:geniv,项目名称:goodflow,代码行数:17,代码来源:Core.php

示例8: isLengthBetween

 public static function isLengthBetween($string, $minLength, $maxLength)
 {
     return Validators::isInRange(Strings::length($string), array($minLength, $maxLength));
 }
开发者ID:jaromir92,项目名称:Sportwin,代码行数:4,代码来源:StringUtils.php

示例9:

Validators::isNumeric(static::filterFloat($control->getValue()));}static
function
validateRange(TextBase$control,$range){return
Validators::isInRange($control->getValue(),$range);}static
开发者ID:JanTvrdik,项目名称:NetteExtras,代码行数:4,代码来源:loader.php

示例10: setQuality

 /**
  * @param int $quality
  * @return PropertyAccess
  * @throws WebChemistry\Images\ImageStorageException
  */
 public function setQuality($quality)
 {
     if (!is_int($quality)) {
         throw new WebChemistry\Images\ImageStorageException(printf('Parameter quality must be integer, %s given.', gettype($quality)));
     } else {
         if (!Nette\Utils\Validators::isInRange($quality, [0, 100])) {
             throw new WebChemistry\Images\ImageStorageException('Quality must be value in range 0 - 100.');
         }
     }
     $this->quality = $quality;
     return $this;
 }
开发者ID:webchemistry,项目名称:images,代码行数:17,代码来源:PropertyAccess.php

示例11: validateLength

 /**
  * Length validator: is control's value length in range?
  * @param  TextBase
  * @param  array  min and max length pair
  * @return bool
  */
 public static function validateLength(TextBase $control, $range)
 {
     if (!is_array($range)) {
         $range = array($range, $range);
     }
     return Validators::isInRange(Strings::length($control->getValue()), $range);
 }
开发者ID:radeksimko,项目名称:nette,代码行数:13,代码来源:TextBase.php

示例12: validateLength

 public static function validateLength(IControl $control, $range)
 {
     if (!is_array($range)) {
         $range = array($range, $range);
     }
     return Validators::isInRange(count($control->getValue()), $range);
 }
开发者ID:pavelkouril,项目名称:nextras-forms,代码行数:7,代码来源:MultiOptionList.php


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