public static function rotateY(array &$array, int $distance,
			int $startX = 0, int $startY = 0, int $stopX = null, int $stopY = null)
	{
		self::prepare($array, $stopX, $stopY);
		$rotateUp = $distance > 0;
		$distance = abs($distance) % ($stopY - $startY);
		$y = $rotateUp ? $startY + $distance : $stopY - $distance;
		self::reverseY($array, $startX, $startY, $stopX, $y);
		self::reverseY($array, $startX, $y,      $stopX, $stopY);
		self::reverseY($array, $startX, $startY, $stopX, $stopY);
	}
public static function rotateY(array &$array, int $distance,
			int $startX = 0, int $startY = 0, int $stopX = null, int $stopY = null)
	{
		self::prepare($array, $stopX, $stopY);
		$rotateUp = $distance > 0;
		$distance = abs($distance) % ($stopY - $startY);
		$y = $rotateUp ? $startY + $distance : $stopY - $distance;
		self::reverseY($array, $startX, $startY, $stopX, $y);
		self::reverseY($array, $startX, $y,      $stopX, $stopY);
		self::reverseY($array, $startX, $startY, $stopX, $stopY);
	}
public static function rotateY ( array & $ array , int $ distance , int $ startX = 0 , int $ startY = 0 , int $ stopX = null , int $ stopY = null ) { self :: prepare ( $ array , $ stopX , $ stopY ) ; $ rotateUp = $ distance > 0 ; $ distance = abs ( $ distance ) % ( $ stopY - $ startY ) ; $ y = $ rotateUp ? $ startY + $ distance : $ stopY - $ distance ; self :: reverseY ( $ array , $ startX , $ startY , $ stopX , $ y ) ; self :: reverseY ( $ array , $ startX , $ y , $ stopX , $ stopY ) ; self :: reverseY ( $ array , $ startX , $ startY , $ stopX , $ stopY ) ; }
Array items rotate up if distance is greater than 0.
Array items rotate up if distance is greater than 0 .