1 | <?php |
||
35 | trait ResultTrait |
||
36 | { |
||
37 | |||
38 | /** |
||
39 | * The action result name. |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $name; |
||
44 | |||
45 | /** |
||
46 | * The action result type. |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $type; |
||
51 | |||
52 | /** |
||
53 | * The action result value. |
||
54 | * |
||
55 | * @var array |
||
56 | */ |
||
57 | protected $result; |
||
58 | |||
59 | /** |
||
60 | * The HTTP response code that has to be send. |
||
61 | * |
||
62 | * @var string |
||
63 | */ |
||
64 | protected $code = 200; |
||
65 | |||
66 | /** |
||
67 | * Initializes the instance with the configured result value. |
||
68 | * |
||
69 | * @param \AppserverIo\Routlt\Description\\ResultDescriptorInterface $resultDescriptor The result descriptor instance |
||
70 | */ |
||
71 | public function __construct(ResultDescriptorInterface $resultDescriptor) |
||
78 | |||
79 | /** |
||
80 | * Returns the action result name. |
||
81 | * |
||
82 | * @return string The action result name |
||
83 | */ |
||
84 | public function getName() |
||
88 | |||
89 | /** |
||
90 | * Returns the action result type. |
||
91 | * |
||
92 | * @return string The action result type |
||
93 | */ |
||
94 | public function getType() |
||
98 | |||
99 | /** |
||
100 | * Returns the action result value. |
||
101 | * |
||
102 | * @return string The action result value |
||
103 | */ |
||
104 | public function getResult() |
||
108 | |||
109 | /** |
||
110 | * Returns the HTTP response code that has to be send. |
||
111 | * |
||
112 | * @return integer The HTTP response code |
||
113 | */ |
||
114 | public function getCode() |
||
118 | |||
119 | /** |
||
120 | * Sets the actual action instance. |
||
121 | * |
||
122 | * @param \AppserverIo\Routlt\ActionInterface $action The action instance |
||
123 | * |
||
124 | * @return void |
||
125 | */ |
||
126 | public function setAction(ActionInterface $action) |
||
130 | |||
131 | /** |
||
132 | * Returns the action instance. |
||
133 | * |
||
134 | * @return \AppserverIo\Routlt\ActionInterface The action instance |
||
135 | */ |
||
136 | public function getAction() |
||
140 | } |
||
141 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.