File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33namespace TraderInteractive ;
44
5+ use TraderInteractive \Exceptions \ReadOnlyViolationException ;
6+
57/**
68 * This object contains the various data returned by a filter action.
79 *
1315 */
1416final class FilterResponse
1517{
18+ /**
19+ * @var array
20+ */
21+ private $ response ;
22+
1623 /**
1724 * @param array $filteredValue The input values after being filtered.
1825 * @param array $errors Any errors encountered during the filter process.
@@ -23,11 +30,24 @@ public function __construct(
2330 array $ errors = [],
2431 array $ unknowns = []
2532 ) {
26- $ this ->success = count ($ errors ) === 0 ;
27- $ this ->filteredValue = $ filteredValue ;
28- $ this ->errors = $ errors ;
29- $ this ->errorMessage = $ this ->success ? null : implode ("\n" , $ errors );
30- $ this ->unknowns = $ unknowns ;
33+ $ success = count ($ errors ) === 0 ;
34+ $ this ->response = [
35+ 'success ' => $ success ,
36+ 'filteredValue ' => $ filteredValue ,
37+ 'errors ' => $ errors ,
38+ 'errorMessage ' => $ success ? null : implode ("\n" , $ errors ),
39+ 'unknowns ' => $ unknowns ,
40+ ];
41+ }
42+
43+ public function __get ($ name )
44+ {
45+ return $ this ->response [$ name ];
46+ }
47+
48+ public function __set ($ name , $ value )
49+ {
50+ throw new ReadOnlyViolationException ("Property {$ name } is read-only " );
3151 }
3252
3353 /**
You can’t perform that action at this time.
0 commit comments