Code Duplication    Length = 4-4 lines in 5 locations

lib/private/legacy/image.php 5 locations

@@ 823-826 (lines=4) @@
820
	 * @return bool
821
	 */
822
	public function resize($maxSize) {
823
		if (!$this->valid()) {
824
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
825
			return false;
826
		}
827
		$widthOrig = imagesx($this->resource);
828
		$heightOrig = imagesy($this->resource);
829
		$ratioOrig = $widthOrig / $heightOrig;
@@ 849-852 (lines=4) @@
846
	 * @return bool
847
	 */
848
	public function preciseResize($width, $height) {
849
		if (!$this->valid()) {
850
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
851
			return false;
852
		}
853
		$widthOrig = imagesx($this->resource);
854
		$heightOrig = imagesy($this->resource);
855
		$process = imagecreatetruecolor($width, $height);
@@ 949-952 (lines=4) @@
946
	 * @return bool for success or failure
947
	 */
948
	public function crop($x, $y, $w, $h) {
949
		if (!$this->valid()) {
950
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
951
			return false;
952
		}
953
		$process = imagecreatetruecolor($w, $h);
954
		if ($process == false) {
955
			$this->logger->error(__METHOD__ . '(): Error creating true color image', array('app' => 'core'));
@@ 988-991 (lines=4) @@
985
	 * @return bool
986
	 */
987
	public function fitIn($maxWidth, $maxHeight) {
988
		if (!$this->valid()) {
989
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
990
			return false;
991
		}
992
		$widthOrig = imagesx($this->resource);
993
		$heightOrig = imagesy($this->resource);
994
		$ratio = $widthOrig / $heightOrig;
@@ 1011-1014 (lines=4) @@
1008
	 * @return bool
1009
	 */
1010
	public function scaleDownToFit($maxWidth, $maxHeight) {
1011
		if (!$this->valid()) {
1012
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
1013
			return false;
1014
		}
1015
		$widthOrig = imagesx($this->resource);
1016
		$heightOrig = imagesy($this->resource);
1017