Issues (145)

src/Controller/PageController.php (1 issue)

Severity
1
<?php
2
3
/**
4
 * @license MIT, http://opensource.org/licenses/MIT
5
 * @copyright Aimeos (aimeos.org), 2015-2023
6
 */
7
8
9
namespace Aimeos\Shop\Controller;
10
11
use Aimeos\Shop\Facades\Shop;
12
use Illuminate\Routing\Controller;
13
use Illuminate\Support\Facades\View;
14
use Illuminate\Support\Facades\Response;
15
16
17
/**
18
 * Aimeos controller for support page request.
19
 */
20
class PageController extends Controller
21
{
22
	/**
23
	 * Returns the html for the content pages.
24
	 *
25
	 * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output
26
	 */
27
	public function indexAction()
28
	{
29
		$params = ['page' => 'page-index'];
30
31
		foreach( app( 'config' )->get( 'shop.page.cms', ['cms/page', 'catalog/tree', 'basket/mini'] ) as $name )
32
		{
33
			$params['aiheader'][$name] = Shop::get( $name )->header();
0 ignored issues
show
The call to Aimeos\Shop\Facades\Shop::get() has too many arguments starting with $name. ( Ignorable by Annotation )

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

33
			$params['aiheader'][$name] = Shop::/** @scrutinizer ignore-call */ get( $name )->header();

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
34
			$params['aibody'][$name] = Shop::get( $name )->body();
35
		}
36
37
		if( empty( $params['aibody']['cms/page'] ) ) {
38
			abort( 404 );
39
		}
40
41
		return Response::view( Shop::template( 'page.index' ), $params )
42
			->header( 'Cache-Control', 'private, max-age=10' );
43
	}
44
}
45