Issues (50)

src/View/Helper/Imageset/Standard.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2019-2026
6
 * @package Base
7
 * @subpackage View
8
 */
9
10
11
namespace Aimeos\Base\View\Helper\Imageset;
12
13
14
/**
15
 * View helper class for creating an image srcset string
16
 *
17
 * @package Base
18
 * @subpackage View
19
 */
20
class Standard
21
	extends \Aimeos\Base\View\Helper\Base
22
	implements \Aimeos\Base\View\Helper\Imageset\Iface
23
{
24
	/**
25
	 * Returns the image srcset value for the given image list
26
	 *
27
	 * @param array $images List of widths as keys and URLs as values
28
	 * @param string $fsname File system name the file is stored at
29
	 * @return string Image srcset value
30
	 */
31
	public function transform( array $images, $fsname = 'fs-media' ) : string
32
	{
33
		$srcset = [];
34
		$view = $this->view();
35
36
		foreach( $images as $type => $path ) {
37
			$srcset[] = $view->content( $path, $fsname ) . ' ' . max( 1, $type ) . 'w';
0 ignored issues
show
The method content() does not exist on Aimeos\Base\View\Iface. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
			$srcset[] = $view->/** @scrutinizer ignore-call */ content( $path, $fsname ) . ' ' . max( 1, $type ) . 'w';
Loading history...
38
		}
39
40
		return join( ', ', $srcset );
41
	}
42
}
43