AccountController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 34
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A downloadAction() 0 4 1
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 account related functionality.
19
 *
20
 * @package symfony
21
 * @subpackage Controller
22
 */
23
class AccountController extends AbstractController
24
{
25
	/**
26
	 * Returns the html for the "My account" page.
27
	 *
28
	 * @return Response Response object containing the generated output
29
	 */
30
	public function indexAction( \Twig\Environment $twig ) : Response
31
	{
32
		$params = [];
33
		$shop = $this->container->get( 'shop' );
34
35
		foreach( $this->container->getParameter( 'aimeos_shop.page' )['account-index'] 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' )['account-index'] 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/Account/index.html.twig', $params ),
43
			200, ['Cache-Control' => 'no-store, , max-age=0']
44
		);
45
	}
46
47
48
	/**
49
	 * Returns the html for the "My account" download page.
50
	 *
51
	 * @return Response Response object containing the generated output
52
	 */
53
	public function downloadAction() : Response
54
	{
55
		$response = $this->container->get( 'shop' )->get( 'account/download' )->view()->response();
56
		return new Response( (string) $response->getBody(), $response->getStatusCode(), $response->getHeaders() );
57
	}
58
}
59