Code Duplication    Length = 8-8 lines in 4 locations

model/Image.php 4 locations

@@ 397-404 (lines=8) @@
394
	 * @param integer $width The maximum width of the output image
395
	 * @return Image
396
	 */
397
	public function ScaleMaxWidth($width) {
398
		// Temporary $force_resample support for 3.x, to be removed in 4.0
399
		if (Config::inst()->get('Image', 'force_resample') && $this->getWidth() <= $width) return $this->ScaleWidth($this->getWidth());
400
401
		return $this->getWidth() > $width
402
			? $this->ScaleWidth($width)
403
			: $this;
404
	}
405
406
	/**
407
	 * Scale image proportionally by height. Use in templates with $ScaleHeight.
@@ 439-446 (lines=8) @@
436
	 * @param integer $height The maximum height of the output image
437
	 * @return Image
438
	 */
439
	public function ScaleMaxHeight($height) {
440
		// Temporary $force_resample support for 3.x, to be removed in 4.0
441
		if (Config::inst()->get('Image', 'force_resample') && $this->getHeight() <= $height) return $this->ScaleHeight($this->getHeight());
442
443
		return $this->getHeight() > $height
444
			? $this->ScaleHeight($height)
445
			: $this;
446
	}
447
448
	/**
449
	 * Crop image on X axis if it exceeds specified width. Retain height.
@@ 456-463 (lines=8) @@
453
	 * @param integer $width The maximum width of the output image
454
	 * @return Image
455
	 */
456
	public function CropWidth($width) {
457
		// Temporary $force_resample support for 3.x, to be removed in 4.0
458
		if (Config::inst()->get('Image', 'force_resample') && $this->getWidth() <= $width) return $this->Fill($this->getWidth(), $this->getHeight());
459
460
		return $this->getWidth() > $width
461
			? $this->Fill($width, $this->getHeight())
462
			: $this;
463
	}
464
465
	/**
466
	 * Crop image on Y axis if it exceeds specified height. Retain width.
@@ 473-480 (lines=8) @@
470
	 * @param integer $height The maximum height of the output image
471
	 * @return Image
472
	 */
473
	public function CropHeight($height) {
474
		// Temporary $force_resample support for 3.x, to be removed in 4.0
475
		if (Config::inst()->get('Image', 'force_resample') && $this->getHeight() <= $height) return $this->Fill($this->getWidth(), $this->getHeight());
476
477
		return $this->getHeight() > $height
478
			? $this->Fill($this->getWidth(), $height)
479
			: $this;
480
	}
481
482
	/**
483
	 * Resize the image by preserving aspect ratio, keeping the image inside the