-
-
Notifications
You must be signed in to change notification settings - Fork 189
/
ViewInterface.php
78 lines (70 loc) · 2.21 KB
/
ViewInterface.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
<?php
namespace Neos\Flow\Mvc\View;
/*
* This file is part of the Neos.Flow package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/
use Neos\Flow\Mvc\ActionResponse;
use Neos\Flow\Mvc\Controller\ControllerContext;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
/**
* Interface of a view
*
* @api
*/
interface ViewInterface
{
/**
* Sets the current controller context
*
* @param ControllerContext $controllerContext Context of the controller associated with this view
* @return void
* @api
*/
public function setControllerContext(ControllerContext $controllerContext);
/**
* Add a variable to the view data collection.
* Can be chained, so $this->view->assign(..., ...)->assign(..., ...); is possible
*
* @param string $key Key of variable
* @param mixed $value Value of object
* @return ViewInterface an instance of $this, to enable chaining
* @api
*/
public function assign($key, $value);
/**
* Add multiple variables to the view data collection
*
* @param array $values array in the format array(key1 => value1, key2 => value2)
* @return ViewInterface an instance of $this, to enable chaining
* @api
*/
public function assignMultiple(array $values);
/**
* Tells if the view implementation can render the view for the given context.
*
* @param ControllerContext $controllerContext
* @return boolean true if the view has something useful to display, otherwise false
*/
public function canRender(ControllerContext $controllerContext);
/**
* Renders the view
*
* @return string|ActionResponse|ResponseInterface|StreamInterface|object The rendered result; object is only handled if __toString() exists!
* @api
*/
public function render();
/**
* Factory method to create an instance with given options.
*
* @param array $options
* @return ViewInterface
*/
public static function createWithOptions(array $options);
}