Checkout   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 56
rs 10
c 2
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 7 1
A confirmAction() 0 7 1
A updateAction() 0 7 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2016
6
 * @package Slim
7
 * @subpackage Controller
8
 */
9
10
namespace Aimeos\Slim\Controller;
11
12
use Psr\Container\ContainerInterface;
13
use Psr\Http\Message\ServerRequestInterface;
14
use Psr\Http\Message\ResponseInterface;
15
16
17
/**
18
 * Aimeos controller for checkout related functionality.
19
 *
20
 * @package Slim
21
 * @subpackage Controller
22
 */
23
class Checkout
24
{
25
	/**
26
	 * Returns the html for the checkout confirmation page.
27
	 *
28
	 * @param ContainerInterface $container Dependency injection container
29
	 * @param ServerRequestInterface $request Request object
30
	 * @param ResponseInterface $response Response object
31
	 * @param array $args Associative list of route parameters
32
	 * @return ResponseInterface $response Modified response object with generated output
33
	 */
34
	public static function confirmAction( ContainerInterface $container, ServerRequestInterface $request,
35
		ResponseInterface $response, array $args ) : ResponseInterface
36
	{
37
		$contents = $container->get( 'shop' )->get( 'checkout-confirm', $request, $response, $args );
38
		$response = $container->get( 'view' )->render( $response, 'Checkout/confirm.html.twig', $contents );
39
40
		return $response->withHeader( 'Cache-Control', 'no-store' );
41
	}
42
43
44
	/**
45
	 * Returns the html for the standard checkout page.
46
	 *
47
	 * @param ContainerInterface $container Dependency injection container
48
	 * @param ServerRequestInterface $request Request object
49
	 * @param ResponseInterface $response Response object
50
	 * @param array $args Associative list of route parameters
51
	 * @return ResponseInterface $response Modified response object with generated output
52
	 */
53
	public static function indexAction( ContainerInterface $container, ServerRequestInterface $request,
54
		ResponseInterface $response, array $args ) : ResponseInterface
55
	{
56
		$contents = $container->get( 'shop' )->get( 'checkout-index', $request, $response, $args );
57
		$response = $container->get( 'view' )->render( $response, 'Checkout/index.html.twig', $contents );
58
59
		return $response->withHeader( 'Cache-Control', 'no-store' );
60
	}
61
62
63
	/**
64
	 * Returns the view for the order update page.
65
	 *
66
	 * @param ContainerInterface $container Dependency injection container
67
	 * @param ServerRequestInterface $request Request object
68
	 * @param ResponseInterface $response Response object
69
	 * @param array $args Associative list of route parameters
70
	 * @return ResponseInterface $response Modified response object with generated output
71
	 */
72
	public static function updateAction( ContainerInterface $container, ServerRequestInterface $request,
73
		ResponseInterface $response, array $args ) : ResponseInterface
74
	{
75
		$contents = $container->get( 'shop' )->get( 'checkout-update', $request, $response, $args );
76
		$response = $container->get( 'view' )->render( $response, 'Checkout/update.html.twig', $contents );
77
78
		return $response->withHeader( 'Cache-Control', 'no-store' );
79
	}
80
}