Issues (121)

src/Aimeos/Shop/Controller/CheckoutController.php (7 issues)

1
<?php
2
3
/**
4
 * @license MIT, http://opensource.org/licenses/MIT
5
 * @copyright Aimeos (aimeos.org), 2015-2016
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\Response;
16
17
18
/**
19
 * Aimeos controller for checkout related functionality.
20
 *
21
 * @package laravel
22
 * @subpackage Controller
23
 */
24
class CheckoutController extends Controller
25
{
26
	/**
27
	 * Returns the html for the checkout confirmation page.
28
	 *
29
	 * @return \Illuminate\Http\Response Response object with output and headers
30
	 */
31
	public function confirmAction()
32
	{
33
		foreach( app( 'config' )->get( 'shop.page.checkout-confirm' ) as $name )
34
		{
35
			$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

35
			$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...
36
			$params['aibody'][$name] = Shop::get( $name )->body();
37
		}
38
39
		return Response::view( Shop::template( 'checkout.confirm' ), $params )
0 ignored issues
show
Comprehensibility Best Practice introduced by Andreas
The variable $params seems to be defined by a foreach iteration on line 33. Are you sure the iterator is never empty, otherwise this variable is not defined?
Loading history...
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

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

53
			$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...
54
			$params['aibody'][$name] = Shop::get( $name )->body();
55
		}
56
57
		return Response::view( Shop::template( 'checkout.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 51. Are you sure the iterator is never empty, otherwise this variable is not defined?
Loading history...
58
			->header( 'Cache-Control', 'no-store, max-age=0' );
59
	}
60
61
62
	/**
63
	 * Returns the view for the order update page.
64
	 *
65
	 * @return \Illuminate\Http\Response Response object with output and headers
66
	 */
67
	public function updateAction()
68
	{
69
		foreach( app( 'config' )->get( 'shop.page.checkout-update' ) as $name )
70
		{
71
			$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

71
			$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...
72
			$params['aibody'][$name] = Shop::get( $name )->body();
73
		}
74
75
		return Response::view( Shop::template( 'checkout.update' ), $params )
0 ignored issues
show
Comprehensibility Best Practice introduced by Andreas
The variable $params seems to be defined by a foreach iteration on line 69. Are you sure the iterator is never empty, otherwise this variable is not defined?
Loading history...
76
			->header( 'Cache-Control', 'no-store, max-age=0' );
77
	}
78
}