public static function filterRange($attrValue, $min, $max, Logger $logger = null)
	{
		$attrValue = filter_var($attrValue, FILTER_VALIDATE_INT);

		if ($attrValue === false)
		{
			return false;
		}

		if ($attrValue < $min)
		{
			if (isset($logger))
			{
				$logger->warn(
					'Value outside of range, adjusted up to min value',
					[
						'attrValue' => $attrValue,
						'min'       => $min,
						'max'       => $max
					]
				);
			}

			return $min;
		}

		if ($attrValue > $max)
		{
			if (isset($logger))
			{
				$logger->warn(
					'Value outside of range, adjusted down to max value',
					[
						'attrValue' => $attrValue,
						'min'       => $min,
						'max'       => $max
					]
				);
			}

			return $max;
		}

		return $attrValue;
	}
public static function filterRange($attrValue, $min, $max, Logger $logger = null)
	{
		$attrValue = filter_var($attrValue, FILTER_VALIDATE_INT);

		if ($attrValue === false)
		{
			return false;
		}

		if ($attrValue < $min)
		{
			if (isset($logger))
			{
				$logger->warn(
					'Value outside of range, adjusted up to min value',
					[
						'attrValue' => $attrValue,
						'min'       => $min,
						'max'       => $max
					]
				);
			}

			return $min;
		}

		if ($attrValue > $max)
		{
			if (isset($logger))
			{
				$logger->warn(
					'Value outside of range, adjusted down to max value',
					[
						'attrValue' => $attrValue,
						'min'       => $min,
						'max'       => $max
					]
				);
			}

			return $max;
		}

		return $attrValue;
	}
public static function filterRange ( $ attrValue , $ min , $ max , Logger $ logger = null ) { $ attrValue = filter_var ( $ attrValue , FILTER_VALIDATE_INT ) ; if ( $ attrValue === false ) { return false ; } if ( $ attrValue < $ min ) { if ( isset ( $ logger ) ) { $ logger -> warn ( 'Value outside of range, adjusted up to min value' , [ 'attrValue' => $ attrValue , 'min' => $ min , 'max' => $ max ] ) ; } return $ min ; } if ( $ attrValue > $ max ) { if ( isset ( $ logger ) ) { $ logger -> warn ( 'Value outside of range, adjusted down to max value' , [ 'attrValue' => $ attrValue , 'min' => $ min , 'max' => $ max ] ) ; } return $ max ; } return $ attrValue ; }
Filter a range value

@param  string  $attrValue Original value
@param  integer $min       Minimum value
@param  integer $max       Maximum value
@param  Logger  $logger    Parser's Logger instance
@return mixed              Filtered value, or FALSE if invalid
Filter a range value