本文整理汇总了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);
}
示例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>';
}
示例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;
}
示例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);
}
示例5: isIntegerInRangeRejectsOtherDataTypes
/**
* @test
* @dataProvider isIntegerInRangeRejectsOtherDataTypesDataProvider
*/
public function isIntegerInRangeRejectsOtherDataTypes($inputValue)
{
$this->assertFalse(\TYPO3\CMS\Core\Utility\MathUtility::isIntegerInRange($inputValue, 0, 10));
}
示例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;
}