Code Duplication    Length = 4-4 lines in 5 locations

lib/private/image.php 5 locations

@@ 798-801 (lines=4) @@
795
	 * @return bool
796
	 */
797
	public function resize($maxSize) {
798
		if (!$this->valid()) {
799
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
800
			return false;
801
		}
802
		$widthOrig = imageSX($this->resource);
803
		$heightOrig = imageSY($this->resource);
804
		$ratioOrig = $widthOrig / $heightOrig;
@@ 824-827 (lines=4) @@
821
	 * @return bool
822
	 */
823
	public function preciseResize($width, $height) {
824
		if (!$this->valid()) {
825
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
826
			return false;
827
		}
828
		$widthOrig = imageSX($this->resource);
829
		$heightOrig = imageSY($this->resource);
830
		$process = imagecreatetruecolor($width, $height);
@@ 924-927 (lines=4) @@
921
	 * @return bool for success or failure
922
	 */
923
	public function crop($x, $y, $w, $h) {
924
		if (!$this->valid()) {
925
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
926
			return false;
927
		}
928
		$process = imagecreatetruecolor($w, $h);
929
		if ($process == false) {
930
			$this->logger->error(__METHOD__ . '(): Error creating true color image', array('app' => 'core'));
@@ 963-966 (lines=4) @@
960
	 * @return bool
961
	 */
962
	public function fitIn($maxWidth, $maxHeight) {
963
		if (!$this->valid()) {
964
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
965
			return false;
966
		}
967
		$widthOrig = imageSX($this->resource);
968
		$heightOrig = imageSY($this->resource);
969
		$ratio = $widthOrig / $heightOrig;
@@ 986-989 (lines=4) @@
983
	 * @return bool
984
	 */
985
	public function scaleDownToFit($maxWidth, $maxHeight) {
986
		if (!$this->valid()) {
987
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
988
			return false;
989
		}
990
		$widthOrig = imageSX($this->resource);
991
		$heightOrig = imageSY($this->resource);
992