1 | <?php |
||
19 | trait ControllerMethods |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * @var ControllerContextInterface |
||
24 | */ |
||
25 | protected $context; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $data = []; |
||
31 | |||
32 | /** |
||
33 | * Sets te context for this controller execution |
||
34 | * |
||
35 | * @param ControllerContextInterface $context |
||
36 | * |
||
37 | * @return self|ControllerInterface |
||
38 | */ |
||
39 | public function runWithContext(ControllerContextInterface $context) |
||
44 | |||
45 | /** |
||
46 | * Sets a variable to the view data model |
||
47 | * |
||
48 | * If you provide an associative array in the $name argument it will be |
||
49 | * set all the elements using the key as the variable name on view |
||
50 | * data model. |
||
51 | * |
||
52 | * @param string|array $name |
||
53 | * @param mixed $value |
||
54 | * |
||
55 | * @return self|ControllerInterface |
||
56 | */ |
||
57 | public function set($name, $value = null) |
||
65 | |||
66 | /** |
||
67 | * A view data model used by renderer |
||
68 | * |
||
69 | * @return array |
||
70 | */ |
||
71 | public function data() |
||
75 | |||
76 | /** |
||
77 | * Adds a multiple values from an associative array |
||
78 | * |
||
79 | * @param array $data |
||
80 | * |
||
81 | * @return self|ControllerInterface |
||
82 | */ |
||
83 | private function setValues(array $data) |
||
90 | } |
||
91 |