Completed
Push — master ( 0c89f9...7a6f38 )
by Aimeos
01:52
created

AccountController::injectContextBase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://www.gnu.org/copyleft/lgpl.html
5
 * @copyright Aimeos (aimeos.org), 2015-2016
6
 * @package flow
7
 * @subpackage Controller
8
 */
9
10
11
namespace Aimeos\Shop\Controller;
12
13
use TYPO3\Flow\Annotations as Flow;
14
15
16
/**
17
 * Account controller
18
 * @package flow
19
 * @subpackage Controller
20
 */
21
class AccountController extends AbstractController
22
{
23
	/**
24
	 * Returns the output of the account favorite component
25
	 *
26
	 * @return string Rendered HTML for the body
27
	 */
28
	public function favoriteComponentAction()
29
	{
30
		$this->view->assign( 'output', $this->getOutput( 'account/favorite' ) );
31
	}
32
33
34
	/**
35
	 * Returns the output of the account history component
36
	 *
37
	 * @return string Rendered HTML for the body
38
	 */
39
	public function historyComponentAction()
40
	{
41
		$this->view->assign( 'output', $this->getOutput( 'account/history' ) );
42
	}
43
44
45
	/**
46
	 * Returns the output of the account watch component
47
	 *
48
	 * @return string Rendered HTML for the body
49
	 */
50
	public function watchComponentAction()
51
	{
52
		$this->view->assign( 'output', $this->getOutput( 'account/watch' ) );
53
	}
54
55
56
	/**
57
	 * Content for MyAccount page
58
	 *
59
	 * @Flow\Session(autoStart = TRUE)
60
	 */
61
	public function indexAction()
62
	{
63
		$this->view->assignMultiple( $this->getSections( 'account-index' ) );
64
	}
65
66
67
	/**
68
	 * Content for MyAccount download page
69
	 *
70
	 * @Flow\Session(autoStart = TRUE)
71
	 */
72
	public function downloadAction()
73
	{
74
		$context = $this->context->get();
75
		$langid = $context->getLocale()->getLanguageId();
76
77
		$view = $this->viewContainer->create( $context->getConfig(), array(), $langid );
0 ignored issues
show
Documentation introduced by
array() is of type array, but the function expects a object<TYPO3\Flow\Mvc\Routing\UriBuilder>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
$langid is of type string|null, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
78
		$context->setView( $view );
79
80
		$client = \Aimeos\Client\Html\Factory::createClient( $context, array(), 'account/download' );
81
		$client->setView( $view );
82
		$client->process();
83
84
		$response = $view->response();
85
		$flowResponse = \TYPO3\Flow\Http\Response::createFromRaw( (string) $response->getBody() );
86
		$flowResponse->setStatus( $response->getStatusCode() );
87
88
		foreach( $response->getHeaders() as $key => $value ) {
89
			$flowResponse->setHeader( $key, $value );
90
		}
91
92
		return $flowResponse;
93
	}
94
}
95