Completed
Push — master ( 99dfa7...cc4116 )
by Aimeos
12:53
created

Flow::getUploadedFiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015
6
 * @package MW
7
 * @subpackage View
8
 */
9
10
11
namespace Aimeos\MW\View\Helper\Request;
12
13
14
/**
15
 * View helper class for generating URLs using the Laravel 5 URL builder.
16
 *
17
 * @package MW
18
 * @subpackage View
19
 */
20
class Flow
21
	extends \Aimeos\MW\View\Helper\Request\Standard
0 ignored issues
show
Coding Style introduced by
The extends keyword must be on the same line as the class name
Loading history...
Coding Style introduced by
Expected 0 spaces between "Standard" and comma; 1 found
Loading history...
22
	implements \Aimeos\MW\View\Helper\Request\Iface
0 ignored issues
show
Coding Style introduced by
The implements keyword must be on the same line as the class name
Loading history...
23
{
24
	private $request;
25
	private $files;
26
27
28
	/**
29
	 * Initializes the request view helper.
30
	 *
31
	 * @param \\Aimeos\MW\View\Iface $view View instance with registered view helpers
32
	 * @param \TYPO3\Flow\Http\Request $request Flow request object
33
	 * @param array $files Uploaded files from $_FILES
34
	 */
35
	public function __construct( \Aimeos\MW\View\Iface $view, \TYPO3\Flow\Http\Request $request, array $files )
36
	{
37
		\Aimeos\MW\View\Helper\Base::__construct( $view );
38
39
		$this->request = $request;
40
		$this->files = $files;
41
	}
42
43
44
	/**
45
	 * Returns the request view helper.
46
	 *
47
	 * @return \Aimeos\MW\View\Helper\Iface Request view helper
48
	 */
49
	public function transform()
50
	{
51
		return $this;
52
	}
53
54
55
	/**
56
	 * Returns the request body.
57
	 *
58
	 * @return string Request body
59
	 */
60
	public function getBody()
61
	{
62
		return $this->request->getContent();
63
	}
64
65
66
	/**
67
	 * Returns the client IP address.
68
	 *
69
	 * @return string Client IP address
70
	 */
71
	public function getClientAddress()
72
	{
73
		return $this->request->getClientIpAddress();
74
	}
75
76
77
	/**
78
	 * Returns the current page or route name
79
	 *
80
	 * @return string|null Current page or route name
81
	 */
82
	public function getTarget()
83
	{
84
		return null;
85
	}
86
87
88
	/**
89
	 * Retrieve normalized file upload data.
90
	 *
91
	 * This method returns upload metadata in a normalized tree, with each leaf
92
	 * an instance of Psr\Http\Message\UploadedFileInterface.
93
	 *
94
	 * These values MAY be prepared from $_FILES or the message body during
95
	 * instantiation, or MAY be injected via withUploadedFiles().
96
	 *
97
	 * @return array An array tree of UploadedFileInterface instances; an empty
98
	 *     array MUST be returned if no data is present.
99
	 */
100
	public function getUploadedFiles()
101
	{
102
		return $this->createUploadedFiles( $this->files );
103
	}
104
}
105