CheckoutController::confirmAction()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 0
dl 0
loc 12
rs 10
c 0
b 0
f 0
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\Response;
14
15
16
/**
17
 * Aimeos controller for checkout related functionality.
18
 */
19
class CheckoutController extends Controller
20
{
21
	/**
22
	 * Returns the html for the checkout confirmation page.
23
	 *
24
	 * @return \Illuminate\Http\Response Response object with output and headers
25
	 */
26
	public function confirmAction()
27
	{
28
		$params = ['page' => 'page-checkout-confirm'];
29
30
		foreach( app( 'config' )->get( 'shop.page.checkout-confirm' ) as $name )
31
		{
32
			$params['aiheader'][$name] = Shop::get( $name )->header();
0 ignored issues
show
Unused Code introduced by
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

32
			$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...
33
			$params['aibody'][$name] = Shop::get( $name )->body();
34
		}
35
36
		return Response::view( Shop::template( 'checkout.confirm' ), $params )
0 ignored issues
show
Bug introduced by
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

36
		return Response::view( Shop::/** @scrutinizer ignore-call */ template( 'checkout.confirm' ), $params )
Loading history...
37
			->header( 'Cache-Control', 'no-store, max-age=0' );
38
	}
39
40
41
	/**
42
	 * Returns the html for the standard checkout page.
43
	 *
44
	 * @return \Illuminate\Http\Response Response object with output and headers
45
	 */
46
	public function indexAction()
47
	{
48
		$params = ['page' => 'page-checkout-index'];
49
50
		foreach( app( 'config' )->get( 'shop.page.checkout-index' ) as $name )
51
		{
52
			$params['aiheader'][$name] = Shop::get( $name )->header();
0 ignored issues
show
Unused Code introduced by
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

52
			$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...
53
			$params['aibody'][$name] = Shop::get( $name )->body();
54
		}
55
56
		return Response::view( Shop::template( 'checkout.index' ), $params )
57
			->header( 'Cache-Control', 'no-store, max-age=0' );
58
	}
59
60
61
	/**
62
	 * Returns the view for the order update page.
63
	 *
64
	 * @return \Illuminate\Http\Response Response object with output and headers
65
	 */
66
	public function updateAction()
67
	{
68
		$params = ['page' => 'page-checkout-update'];
69
70
		foreach( app( 'config' )->get( 'shop.page.checkout-update' ) as $name )
71
		{
72
			$params['aiheader'][$name] = Shop::get( $name )->header();
0 ignored issues
show
Unused Code introduced by
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

72
			$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...
73
			$params['aibody'][$name] = Shop::get( $name )->body();
74
		}
75
76
		return Response::view( Shop::template( 'checkout.update' ), $params )
77
			->header( 'Cache-Control', 'no-store, max-age=0' );
78
	}
79
}