This repository has been archived by the owner on Jul 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Flow.php
110 lines (90 loc) · 2.2 KB
/
Flow.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
* @copyright Aimeos (aimeos.org), 2015
* @package MW
* @subpackage View
*/
namespace Aimeos\MW\View\Helper\Request;
/**
* View helper class for generating URLs using the Laravel 5 URL builder.
*
* @package MW
* @subpackage View
*/
class Flow
extends \Aimeos\MW\View\Helper\Request\Standard
implements \Aimeos\MW\View\Helper\Request\Iface
{
private $request;
private $files;
/**
* Initializes the request view helper.
*
* @param \\Aimeos\MW\View\Iface $view View instance with registered view helpers
* @param \TYPO3\Flow\Http\Request $request Flow request object
* @param array $files Uploaded files from $_FILES
*/
public function __construct( \Aimeos\MW\View\Iface $view, \TYPO3\Flow\Http\Request $request, array $files )
{
\Aimeos\MW\View\Helper\Base::__construct( $view );
$this->request = $request;
$this->files = $files;
}
/**
* Returns the request view helper.
*
* @return \Aimeos\MW\View\Helper\Iface Request view helper
*/
public function transform()
{
return $this;
}
/**
* Returns the request body.
*
* @return string Request body
*/
public function getBody()
{
return $this->request->getContent();
}
/**
* Returns the client IP address.
*
* @return string Client IP address
*/
public function getClientAddress()
{
return $this->request->getClientIpAddress();
}
/**
* Returns the current page or route name
*
* @return string|null Current page or route name
*/
public function getTarget()
{
return null;
}
/**
* Retrieve normalized file upload data.
*
* This method returns upload metadata in a normalized tree, with each leaf
* an instance of Psr\Http\Message\UploadedFileInterface.
*
* These values MAY be prepared from $_FILES or the message body during
* instantiation, or MAY be injected via withUploadedFiles().
*
* @return array An array tree of UploadedFileInterface instances; an empty
* array MUST be returned if no data is present.
*/
public function getUploadedFiles()
{
$list = array();
foreach( $this->files as $name => $array ) {
$list[$name] = $this->createUploadedFiles( $array );
}
return $list;
}
}