Skip to content

Commit

Permalink
Remove unused params
Browse files Browse the repository at this point in the history
#4246743
  • Loading branch information
andernath committed May 29, 2024
1 parent 3cad47c commit 5419dd8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
20 changes: 7 additions & 13 deletions plugin/EstateList.php
Original file line number Diff line number Diff line change
Expand Up @@ -716,29 +716,23 @@ public function getEstatePictureTitle($imageId)
*/
public function getResponsiveImageSource(int $imageId, int $breakPoint, float $width = null, float $height = null, bool $maxWidth = false) {
$sourceTag = '<source media="(' . ($maxWidth ? 'max-width:' : 'min-width:') . $breakPoint . 'px)" srcset="';
$width15 = round($width * 1.5);
$width2 = round($width * 2);
$width3 = round($width * 3);
$height15 = round($height * 1.5);
$height2 = round($height * 2);
$height3 = round($height * 3);
$pictureOptions1 = null;
$pictureOptions15 = null;
$pictureOptions2 = null;
$pictureOptions3 = null;

if(isset($width) || isset($height)) {
$pictureOptions1 = ['width'=> isset($width) ? $width : null, 'height'=> isset($height) ? $height : null];
$pictureOptions15 = ['width'=> isset($width) ? $width15 : null, 'height'=>isset($height) ? $height15 : null];
$pictureOptions2 = ['width'=> isset($width) ? $width2 : null, 'height'=>isset($height) ? $height2 : null];
$pictureOptions3 = ['width'=> isset($width) ? $width3 : null, 'height'=>isset($height) ? $height3 : null];
$pictureOptions15 = ['width'=> isset($width) ? round($width * 1.5) : null, 'height'=>isset($height) ? round($height * 1.5) : null];
$pictureOptions2 = ['width'=> isset($width) ? round($width * 2) : null, 'height'=>isset($height) ? round($height * 2) : null];
$pictureOptions3 = ['width'=> isset($width) ? round($width * 3) : null, 'height'=>isset($height) ? round($height * 3) : null];
}

return $sourceTag .
$this->getEstatePictureUrl($imageId, $pictureOptions1) . (isset($width) ? '&w=' . $width : '') . (isset($height) ? '&h=' . $height : '') . ' 1x,' .
$this->getEstatePictureUrl($imageId, $pictureOptions15) . (isset($width) ? '&w=' . $width15 : '') . (isset($height) ? '&h=' . $height15 : '') . ' 1.5x,' .
$this->getEstatePictureUrl($imageId, $pictureOptions2) . (isset($width) ? '&w=' . $width2 : '') . (isset($height) ? '&h=' . $height2 : '') . ' 2x,' .
$this->getEstatePictureUrl($imageId, $pictureOptions3) . (isset($width) ? '&w=' . $width3 : '') . (isset($height) ? '&h=' . $height3 : '') . ' 3x">';
$this->getEstatePictureUrl($imageId, $pictureOptions1) . ' 1x,' .
$this->getEstatePictureUrl($imageId, $pictureOptions15) . ' 1.5x,' .
$this->getEstatePictureUrl($imageId, $pictureOptions2) . ' 2x,' .
$this->getEstatePictureUrl($imageId, $pictureOptions3) . ' 3x">';
}

/**
Expand Down
25 changes: 15 additions & 10 deletions tests/TestClassEstateList.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,9 @@ public function testGetResponsiveImageSource()
$this->_pEstateList->loadEstates();
$this->_pEstateList->estateIterator();
$output = $this->_pEstateList->getResponsiveImageSource(2, 1600, 456, round((456* 2) / 3));
$this->assertEquals($output,
'<source media="(min-width:1600px)" srcset="https://test.url/image/2.jpg@456x304&w=456&h=304 1x,https://test.url/image/2.jpg@684x456&w=684&h=456 1.5x,https://test.url/image/2.jpg@912x608&w=912&h=608 2x,https://test.url/image/2.jpg@1368x912&w=1368&h=912 3x">'
$this->assertEquals(
'<source media="(min-width:1600px)" srcset="https://test.url/image/2.jpg@456x304 1x,https://test.url/image/2.jpg@684x456 1.5x,https://test.url/image/2.jpg@912x608 2x,https://test.url/image/2.jpg@1368x912 3x">',
$output
);
}

Expand All @@ -431,8 +432,9 @@ public function testGetResponsiveImageSourceForMobile()
$this->_pEstateList->loadEstates();
$this->_pEstateList->estateIterator();
$output = $this->_pEstateList->getResponsiveImageSource(2, 575, 456, round((456* 2) / 3), true);
$this->assertEquals($output,
'<source media="(max-width:575px)" srcset="https://test.url/image/2.jpg@456x304&w=456&h=304 1x,https://test.url/image/2.jpg@684x456&w=684&h=456 1.5x,https://test.url/image/2.jpg@912x608&w=912&h=608 2x,https://test.url/image/2.jpg@1368x912&w=1368&h=912 3x">'
$this->assertEquals(
'<source media="(max-width:575px)" srcset="https://test.url/image/2.jpg@456x304 1x,https://test.url/image/2.jpg@684x456 1.5x,https://test.url/image/2.jpg@912x608 2x,https://test.url/image/2.jpg@1368x912 3x">',
$output
);
}

Expand All @@ -441,8 +443,9 @@ public function testGetResponsiveImageSourceWithoutWidth()
$this->_pEstateList->loadEstates();
$this->_pEstateList->estateIterator();
$output = $this->_pEstateList->getResponsiveImageSource(2, 1600, null, 400);
$this->assertEquals($output,
'<source media="(min-width:1600px)" srcset="https://test.url/image/2.jpg@x400&h=400 1x,https://test.url/image/2.jpg@x600&h=600 1.5x,https://test.url/image/2.jpg@x800&h=800 2x,https://test.url/image/2.jpg@x1200&h=1200 3x">'
$this->assertEquals(
'<source media="(min-width:1600px)" srcset="https://test.url/image/2.jpg@x400 1x,https://test.url/image/2.jpg@x600 1.5x,https://test.url/image/2.jpg@x800 2x,https://test.url/image/2.jpg@x1200 3x">',
$output
);
}

Expand All @@ -451,8 +454,9 @@ public function testGetResponsiveImageSourceWithoutHeight()
$this->_pEstateList->loadEstates();
$this->_pEstateList->estateIterator();
$output = $this->_pEstateList->getResponsiveImageSource(2, 1600, 456);
$this->assertEquals($output,
'<source media="(min-width:1600px)" srcset="https://test.url/image/2.jpg@456x&w=456 1x,https://test.url/image/2.jpg@684x&w=684 1.5x,https://test.url/image/2.jpg@912x&w=912 2x,https://test.url/image/2.jpg@1368x&w=1368 3x">'
$this->assertEquals(
'<source media="(min-width:1600px)" srcset="https://test.url/image/2.jpg@456x 1x,https://test.url/image/2.jpg@684x 1.5x,https://test.url/image/2.jpg@912x 2x,https://test.url/image/2.jpg@1368x 3x">',
$output
);
}

Expand All @@ -461,8 +465,9 @@ public function testGetResponsiveImageSourceWithoutWidthWithoutHeight()
$this->_pEstateList->loadEstates();
$this->_pEstateList->estateIterator();
$output = $this->_pEstateList->getResponsiveImageSource(2, 1600);
$this->assertEquals($output,
'<source media="(min-width:1600px)" srcset="https://test.url/image/2.jpg 1x,https://test.url/image/2.jpg 1.5x,https://test.url/image/2.jpg 2x,https://test.url/image/2.jpg 3x">'
$this->assertEquals(
'<source media="(min-width:1600px)" srcset="https://test.url/image/2.jpg 1x,https://test.url/image/2.jpg 1.5x,https://test.url/image/2.jpg 2x,https://test.url/image/2.jpg 3x">',
$output
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/resources/templates/output_default_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>flach begrüntes Grundstück</h1>
</div>
<div class="oo-details-main">
<div class="oo-detailsgallery" id="oo-galleryslide">
<div class="oo-detailspicture"><picture class="oo-picture"><source media="(max-width:575px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=545 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=818 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1090 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1635 3x"><source media="(min-width:1600px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1400 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=2100 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=2800 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=4200 3x"><source media="(min-width:1400px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1170 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1755 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=2340 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=3510 3x"><source media="(min-width:1200px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1020 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1530 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=2040 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=3060 3x"><source media="(min-width:992px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=870 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1305 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1740 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=2610 3x"><source media="(min-width:768px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=960 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1440 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1920 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=2880 3x"><source media="(min-width:576px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=740 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1110 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=1480 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg&w=2220 3x"><img class="oo-responsive-image estate-status" src="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg" alt="Fotolia_3286409_Subscription_XL" loading="lazy"/></picture></div> </div>
<div class="oo-detailspicture"><picture class="oo-picture"><source media="(max-width:575px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 3x"><source media="(min-width:1600px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 3x"><source media="(min-width:1400px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 3x"><source media="(min-width:1200px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 3x"><source media="(min-width:992px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 3x"><source media="(min-width:768px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 3x"><source media="(min-width:576px)" srcset="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 1.5x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 2x,https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg 3x"><img class="oo-responsive-image estate-status" src="https://image.onoffice.de/smart25/Objekte/index.php?kunde=Ivanova&#038;datensatz=52&#038;filename=Titelbild_362.jpg" alt="Fotolia_3286409_Subscription_XL" loading="lazy"/></picture></div> </div>
<div class="oo-detailstable">
<div class="oo-detailslisttd">label-objektart</div>
<div class="oo-detailslisttd">Grundstück</div>
Expand Down

0 comments on commit 5419dd8

Please sign in to comment.