PageController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
c 1
b 0
f 0
dl 0
loc 39
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 10 2
A privacyAction() 0 3 1
A termsAction() 0 3 1
1
<?php
2
3
/**
4
 * @license MIT, http://opensource.org/licenses/MIT
5
 * @copyright Aimeos (aimeos.org), 2015-2021
6
 * @package laravel
7
 * @subpackage Controller
8
 */
9
10
11
namespace Aimeos\Shop\Controller;
12
13
use Aimeos\Shop\Facades\Shop;
14
use Illuminate\Routing\Controller;
15
use Illuminate\Support\Facades\View;
16
use Illuminate\Support\Facades\Response;
17
18
19
/**
20
 * Aimeos controller for support page request.
21
 *
22
 * @package laravel
23
 * @subpackage Controller
24
 */
25
class PageController extends Controller
26
{
27
	/**
28
	 * Returns the html for the content pages.
29
	 *
30
	 * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output
31
	 */
32
	public function indexAction()
33
	{
34
		foreach( app( 'config' )->get( 'shop.page.cms', ['cms/page', 'basket/mini'] ) as $name )
35
		{
36
			$params['aiheader'][$name] = Shop::get( $name )->getHeader();
0 ignored issues
show
Unused Code introduced by Andreas
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

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

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...
37
			$params['aibody'][$name] = Shop::get( $name )->getBody();
38
		}
39
40
		return Response::view( Shop::template( 'page.index' ), $params )
0 ignored issues
show
Comprehensibility Best Practice introduced by Andreas
The variable $params seems to be defined by a foreach iteration on line 34. Are you sure the iterator is never empty, otherwise this variable is not defined?
Loading history...
Bug introduced by Andreas
The method template() does not exist on Aimeos\Shop\Facades\Shop. Since you implemented __callStatic, 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

40
		return Response::view( Shop::/** @scrutinizer ignore-call */ template( 'page.index' ), $params )
Loading history...
41
			->header( 'Cache-Control', 'private, max-age=10' );
42
	}
43
44
45
	/**
46
	 * Returns the html for the privacy policy page.
47
	 *
48
	 * @return \Illuminate\Contracts\View\View View for rendering the output
49
	 */
50
	public function privacyAction()
51
	{
52
		return View::make( Shop::template( 'page.privacy' ) );
53
	}
54
55
56
	/**
57
	 * Returns the html for the terms and conditions page.
58
	 *
59
	 * @return \Illuminate\Contracts\View\View View for rendering the output
60
	 */
61
	public function termsAction()
62
	{
63
		return View::make( Shop::template( 'page.terms' ) );
64
	}
65
}
66