You are here

public static function video_utility::roundToEvenNumber in Video 7.2

Returns the nearest even integer given an int or float.

When equal, it will choose the highest nearest even integer.

2 calls to video_utility::roundToEvenNumber()
TranscoderAbstractionFactoryFfmpeg::setAspectRatioOptions in transcoders/TranscoderAbstractionFactoryFfmpeg.inc
Set aspect ratio and size related transcoder options.
VideoUtilityTestCase::testRoundToEvenNumber in tests/VideoUtility.test

File

./video.utility.inc, line 323
This file will be used to keep all utility functions data structures.

Class

video_utility
Helper functions for the Video module.

Code

public static function roundToEvenNumber($number) {
  $remainder = fmod($number, 2);
  if ($remainder == 0) {
    return (int) $number;
  }
  elseif ($remainder < 1) {
    return (int) ($number - $remainder);
  }
  return (int) ($number - $remainder + 2);
}