CheckoutController   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 25
c 1
b 0
f 0
dl 0
loc 67
rs 10
wmc 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A confirmAction() 0 14 2
A updateAction() 0 14 2
A indexAction() 0 14 2
1
<?php
2
3
/**
4
 * @license MIT, http://opensource.org/licenses/MIT
5
 * @copyright Aimeos (aimeos.org), 2014-2016
6
 * @package symfony
7
 * @subpackage Controller
8
 */
9
10
11
namespace Aimeos\ShopBundle\Controller;
12
13
use Symfony\Component\HttpFoundation\Response;
14
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
15
16
17
/**
18
 * Aimeos controller for checkout related functionality.
19
 *
20
 * @package symfony
21
 * @subpackage Controller
22
 */
23
class CheckoutController extends AbstractController
24
{
25
	/**
26
	 * Returns the html for the checkout confirmation page.
27
	 *
28
	 * @return Response Response object containing the generated output
29
	 */
30
	public function confirmAction( \Twig\Environment $twig ) : Response
31
	{
32
		$params = [];
33
		$shop = $this->container->get( 'shop' );
34
35
		foreach( $this->container->getParameter( 'aimeos_shop.page' )['checkout-confirm'] as $name )
0 ignored issues
show
Bug introduced by
The method getParameter() does not exist on Psr\Container\ContainerInterface. It seems like you code against a sub-type of Psr\Container\ContainerInterface such as Symfony\Component\Depend...tion\ContainerInterface. ( Ignorable by Annotation )

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

35
		foreach( $this->container->/** @scrutinizer ignore-call */ getParameter( 'aimeos_shop.page' )['checkout-confirm'] as $name )
Loading history...
36
		{
37
			$params['aiheader'][$name] = $shop->get( $name )->header();
38
			$params['aibody'][$name] = $shop->get( $name )->body();
39
		}
40
41
		return new Response(
42
			$twig->render( '@AimeosShop/Checkout/confirm.html.twig', $params ),
43
			200, ['Cache-Control' => 'no-store, , max-age=0']
44
		);
45
	}
46
47
48
	/**
49
	 * Returns the html for the standard checkout page.
50
	 *
51
	 * @return Response Response object containing the generated output
52
	 */
53
	public function indexAction( \Twig\Environment $twig ) : Response
54
	{
55
		$params = [];
56
		$shop = $this->container->get( 'shop' );
57
58
		foreach( $this->container->getParameter( 'aimeos_shop.page' )['checkout-index'] as $name )
59
		{
60
			$params['aiheader'][$name] = $shop->get( $name )->header();
61
			$params['aibody'][$name] = $shop->get( $name )->body();
62
		}
63
64
		return new Response(
65
			$twig->render( '@AimeosShop/Checkout/index.html.twig', $params ),
66
			200, ['Cache-Control' => 'no-store, , max-age=0']
67
		);
68
	}
69
70
71
	/**
72
	 * Returns the view for the order update page.
73
	 *
74
	 * @return Response Response object containing the generated output
75
	 */
76
	public function updateAction( \Twig\Environment $twig ) : Response
77
	{
78
		$params = [];
79
		$shop = $this->container->get( 'shop' );
80
81
		foreach( $this->container->getParameter( 'aimeos_shop.page' )['checkout-update'] as $name )
82
		{
83
			$params['aiheader'][$name] = $shop->get( $name )->header();
84
			$params['aibody'][$name] = $shop->get( $name )->body();
85
		}
86
87
		return new Response(
88
			$twig->render( '@AimeosShop/Checkout/update.html.twig', $params ),
89
			200, ['Cache-Control' => 'no-store, , max-age=0']
90
		);
91
	}
92
}
93