Code Duplication    Length = 4-4 lines in 5 locations

lib/private/legacy/image.php 5 locations

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