@@ -46,47 +46,56 @@ class DataObjectProcessor
46
46
*/
47
47
private $ processors ;
48
48
49
+ /**
50
+ * @var array[]
51
+ */
52
+ private $ excludedMethodsClassMap ;
53
+
49
54
/**
50
55
* @param MethodsMap $methodsMapProcessor
51
56
* @param TypeCaster $typeCaster
52
57
* @param FieldNamer $fieldNamer
53
58
* @param CustomAttributesProcessor $customAttributesProcessor
54
59
* @param ExtensionAttributesProcessor $extensionAttributesProcessor
55
60
* @param array $processors
61
+ * @param array $excludedMethodsClassMap
56
62
*/
57
63
public function __construct (
58
64
MethodsMap $ methodsMapProcessor ,
59
65
TypeCaster $ typeCaster ,
60
66
FieldNamer $ fieldNamer ,
61
67
CustomAttributesProcessor $ customAttributesProcessor ,
62
68
ExtensionAttributesProcessor $ extensionAttributesProcessor ,
63
- array $ processors = []
69
+ array $ processors = [],
70
+ array $ excludedMethodsClassMap = []
64
71
) {
65
72
$ this ->methodsMapProcessor = $ methodsMapProcessor ;
66
73
$ this ->typeCaster = $ typeCaster ;
67
74
$ this ->fieldNamer = $ fieldNamer ;
68
75
$ this ->extensionAttributesProcessor = $ extensionAttributesProcessor ;
69
76
$ this ->customAttributesProcessor = $ customAttributesProcessor ;
70
77
$ this ->processors = $ processors ;
78
+ $ this ->excludedMethodsClassMap = $ excludedMethodsClassMap ;
71
79
}
72
80
73
81
/**
74
82
* Use class reflection on given data interface to build output data array
75
83
*
76
84
* @param mixed $dataObject
77
85
* @param string $dataObjectType
78
- * @param array $excludedMethods - list of methods to exclude from being called
79
86
* @return array
80
87
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
81
88
* @SuppressWarnings(PHPMD.NPathComplexity)
82
89
*/
83
- public function buildOutputDataArray ($ dataObject , $ dataObjectType, array $ excludedMethods = [] )
90
+ public function buildOutputDataArray ($ dataObject , $ dataObjectType )
84
91
{
85
92
$ methods = $ this ->methodsMapProcessor ->getMethodsMap ($ dataObjectType );
86
93
$ outputData = [];
87
94
95
+ $ excludedMethodsForDataObjectType = $ this ->excludedMethodsClassMap [$ dataObjectType ] ?? [];
96
+
88
97
foreach (array_keys ($ methods ) as $ methodName ) {
89
- if (in_array ($ methodName , $ excludedMethods )) {
98
+ if (in_array ($ methodName , $ excludedMethodsForDataObjectType )) {
90
99
continue ;
91
100
}
92
101
0 commit comments