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


PHP MathUtility::isIntegerInRange方法代码示例

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


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

示例1: isVersionSuitable

 /**
  * Check if current TYPO3 version is suitable for the extension
  *
  * @param string $lowestVersion
  * @param string $highestVersion
  * @return bool
  */
 protected static function isVersionSuitable($lowestVersion, $highestVersion)
 {
     $numericTypo3Version = VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getNumericTypo3Version());
     $numericLowestVersion = VersionNumberUtility::convertVersionNumberToInteger($lowestVersion);
     $numericHighestVersion = VersionNumberUtility::convertVersionNumberToInteger($highestVersion);
     return MathUtility::isIntegerInRange($numericTypo3Version, $numericLowestVersion, $numericHighestVersion);
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:14,代码来源:Typo3DependencyViewHelper.php

示例2: renderStatic

 /**
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $title = $arguments['title'];
     $message = $arguments['message'];
     $state = $arguments['state'];
     $isInRange = MathUtility::isIntegerInRange($state, -2, 2);
     if (!$isInRange) {
         $state = -2;
     }
     $iconName = $arguments['iconName'];
     $disableIcon = $arguments['disableIcon'];
     if ($message === null) {
         $messageTemplate = $renderChildrenClosure();
     } else {
         $messageTemplate = htmlspecialchars($message);
     }
     $classes = [self::STATE_NOTICE => 'notice', self::STATE_INFO => 'info', self::STATE_OK => 'success', self::STATE_WARNING => 'warning', self::STATE_ERROR => 'danger'];
     $icons = [self::STATE_NOTICE => 'lightbulb-o', self::STATE_INFO => 'info', self::STATE_OK => 'check', self::STATE_WARNING => 'exclamation', self::STATE_ERROR => 'times'];
     $stateClass = $classes[$state];
     $icon = $icons[$state];
     if ($iconName !== null) {
         $icon = $iconName;
     }
     $iconTemplate = '';
     if (!$disableIcon) {
         $iconTemplate = '' . '<div class="media-left">' . '<span class="fa-stack fa-lg callout-icon">' . '<i class="fa fa-circle fa-stack-2x"></i>' . '<i class="fa fa-' . htmlspecialchars($icon) . ' fa-stack-1x"></i>' . '</span>' . '</div>';
     }
     $titleTemplate = '';
     if ($title !== null) {
         $titleTemplate = '<h4 class="callout-title">' . htmlspecialchars($title) . '</h4>';
     }
     return '<div class="callout callout-' . htmlspecialchars($stateClass) . '">' . '<div class="media">' . $iconTemplate . '<div class="media-body">' . $titleTemplate . '<div class="callout-body">' . $messageTemplate . '</div>' . '</div>' . '</div>' . '</div>';
 }
开发者ID:vip3out,项目名称:TYPO3.CMS,代码行数:40,代码来源:InfoboxViewHelper.php

示例3: getCompressionLevel

 /**
  * Get compression level
  *
  * @return int
  */
 protected function getCompressionLevel()
 {
     $level = isset($GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel']) ? (int) $GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel'] : self::DEFAULT_COMPRESSION_LEVEL;
     if (!MathUtility::isIntegerInRange($level, 1, 9)) {
         $level = self::DEFAULT_COMPRESSION_LEVEL;
     }
     return $level;
 }
开发者ID:qbus-agentur,项目名称:nc_staticfilecache,代码行数:13,代码来源:AbstractBackend.php

示例4: isValidLevel

 /**
  * Checks a level for validity,
  * whether it is an integer and in the range of 0-7.
  *
  * @param integer $level log level to validate
  * @return boolean TRUE if the given log level is valid, FALSE otherwise
  */
 public static function isValidLevel($level)
 {
     return \TYPO3\CMS\Core\Utility\MathUtility::isIntegerInRange($level, self::EMERGENCY, self::DEBUG);
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:11,代码来源:LogLevel.php

示例5: isIntegerInRangeRejectsOtherDataTypes

 /**
  * @test
  * @dataProvider isIntegerInRangeRejectsOtherDataTypesDataProvider
  */
 public function isIntegerInRangeRejectsOtherDataTypes($inputValue)
 {
     $this->assertFalse(\TYPO3\CMS\Core\Utility\MathUtility::isIntegerInRange($inputValue, 0, 10));
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:8,代码来源:MathUtilityTest.php

示例6: validateAdditionalFields

 /**
  * Validate additional fields
  *
  * @param array $submittedData Reference to the array containing the data submitted by the user
  * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject Reference to the calling object (Scheduler's BE module)
  * @return boolean True if validation was ok (or selected class is not relevant), false otherwise
  */
 public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject)
 {
     if (!MathUtility::canBeInterpretedAsInteger($submittedData['scheduler_fileStorageIndexing_storage']) || !MathUtility::canBeInterpretedAsInteger($submittedData['scheduler_fileStorageIndexing_fileCount'])) {
         return FALSE;
     } elseif (\TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getStorageObject($submittedData['scheduler_fileStorageIndexing_storage']) === NULL) {
         return FALSE;
     } elseif (!MathUtility::isIntegerInRange($submittedData['scheduler_fileStorageIndexing_fileCount'], 1, 9999)) {
         return FALSE;
     }
     return TRUE;
 }
开发者ID:samuweiss,项目名称:TYPO3-Site,代码行数:18,代码来源:FileStorageExtractionAdditionalFieldProvider.php


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