Completed
Push — master ( eefa42...ca12bb )
by Aimeos
01:56
created

AccountController::historyComponentAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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
	protected $contextBase;
24
	protected $viewBase;
25
26
27
	/**
28
	 * Returns the output of the account favorite component
29
	 *
30
	 * @return string Rendered HTML for the body
31
	 */
32
	public function favoriteComponentAction()
33
	{
34
		$this->view->assign( 'output', $this->getOutput( 'account/favorite' ) );
35
	}
36
37
38
	/**
39
	 * Returns the output of the account history component
40
	 *
41
	 * @return string Rendered HTML for the body
42
	 */
43
	public function historyComponentAction()
44
	{
45
		$this->view->assign( 'output', $this->getOutput( 'account/history' ) );
46
	}
47
48
49
	/**
50
	 * Returns the output of the account watch component
51
	 *
52
	 * @return string Rendered HTML for the body
53
	 */
54
	public function watchComponentAction()
55
	{
56
		$this->view->assign( 'output', $this->getOutput( 'account/watch' ) );
57
	}
58
59
60
	/**
61
	 * Content for MyAccount page
62
	 *
63
	 * @Flow\Session(autoStart = TRUE)
64
	 */
65
	public function indexAction()
66
	{
67
		$this->view->assignMultiple( $this->getSections( 'account-index' ) );
68
	}
69
70
71
	/**
72
	 * Content for MyAccount download page
73
	 *
74
	 * @Flow\Session(autoStart = TRUE)
75
	 */
76
	public function downloadAction()
77
	{
78
		$context = $this->contextBase->get();
79
		$langid = $context->getLocale()->getLanguageId();
80
81
		$view = $this->viewBase->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...
82
		$context->setView( $view );
83
84
		$client = \Aimeos\Client\Html\Factory::createClient( $context, array(), 'account/download' );
85
		$client->setView( $view );
86
		$client->process();
87
88
		$response = $view->response();
89
		$flowResponse = \TYPO3\Flow\Http\Response::createFromRaw( (string) $response->getBody() );
90
		$flowResponse->setStatus( $response->getStatusCode() );
91
92
		foreach( $response->getHeaders() as $key => $value ) {
93
			$flowResponse->setHeader( $key, $value );
94
		}
95
96
		return $flowResponse;
97
	}
98
99
100
	/**
101
	 * Context object injector
102
	 *
103
	 * @param \Aimeos\Shop\Base\Context $context
104
	 */
105
	public function injectContext( \Aimeos\Shop\Base\Context $context )
106
	{
107
		$this->contextBase = $context;
108
	}
109
110
111
	/**
112
	 * View object injector
113
	 *
114
	 * @param \Aimeos\Shop\Base\View $view
115
	 */
116
	public function injectView( \Aimeos\Shop\Base\View $view )
117
	{
118
		$this->viewBase = $view;
119
	}
120
}
121