Code Duplication    Length = 4-4 lines in 5 locations

lib/private/legacy/image.php 5 locations

@@ 850-853 (lines=4) @@
847
	 * @return bool
848
	 */
849
	public function resize($maxSize) {
850
		if (!$this->valid()) {
851
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
852
			return false;
853
		}
854
		$widthOrig = imagesx($this->resource);
855
		$heightOrig = imagesy($this->resource);
856
		$ratioOrig = $widthOrig / $heightOrig;
@@ 876-879 (lines=4) @@
873
	 * @return bool
874
	 */
875
	public function preciseResize($width, $height) {
876
		if (!$this->valid()) {
877
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
878
			return false;
879
		}
880
		$widthOrig = imagesx($this->resource);
881
		$heightOrig = imagesy($this->resource);
882
		$process = imagecreatetruecolor($width, $height);
@@ 976-979 (lines=4) @@
973
	 * @return bool for success or failure
974
	 */
975
	public function crop($x, $y, $w, $h) {
976
		if (!$this->valid()) {
977
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
978
			return false;
979
		}
980
		$process = imagecreatetruecolor($w, $h);
981
		if ($process == false) {
982
			$this->logger->error(__METHOD__ . '(): Error creating true color image', array('app' => 'core'));
@@ 1015-1018 (lines=4) @@
1012
	 * @return bool
1013
	 */
1014
	public function fitIn($maxWidth, $maxHeight) {
1015
		if (!$this->valid()) {
1016
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
1017
			return false;
1018
		}
1019
		$widthOrig = imagesx($this->resource);
1020
		$heightOrig = imagesy($this->resource);
1021
		$ratio = $widthOrig / $heightOrig;
@@ 1038-1041 (lines=4) @@
1035
	 * @return bool
1036
	 */
1037
	public function scaleDownToFit($maxWidth, $maxHeight) {
1038
		if (!$this->valid()) {
1039
			$this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core'));
1040
			return false;
1041
		}
1042
		$widthOrig = imagesx($this->resource);
1043
		$heightOrig = imagesy($this->resource);
1044