@@ -46,47 +46,56 @@ class DataObjectProcessor
4646 */
4747 private $ processors ;
4848
49+ /**
50+ * @var array[]
51+ */
52+ private $ excludedMethodsClassMap ;
53+
4954 /**
5055 * @param MethodsMap $methodsMapProcessor
5156 * @param TypeCaster $typeCaster
5257 * @param FieldNamer $fieldNamer
5358 * @param CustomAttributesProcessor $customAttributesProcessor
5459 * @param ExtensionAttributesProcessor $extensionAttributesProcessor
5560 * @param array $processors
61+ * @param array $excludedMethodsClassMap
5662 */
5763 public function __construct (
5864 MethodsMap $ methodsMapProcessor ,
5965 TypeCaster $ typeCaster ,
6066 FieldNamer $ fieldNamer ,
6167 CustomAttributesProcessor $ customAttributesProcessor ,
6268 ExtensionAttributesProcessor $ extensionAttributesProcessor ,
63- array $ processors = []
69+ array $ processors = [],
70+ array $ excludedMethodsClassMap = []
6471 ) {
6572 $ this ->methodsMapProcessor = $ methodsMapProcessor ;
6673 $ this ->typeCaster = $ typeCaster ;
6774 $ this ->fieldNamer = $ fieldNamer ;
6875 $ this ->extensionAttributesProcessor = $ extensionAttributesProcessor ;
6976 $ this ->customAttributesProcessor = $ customAttributesProcessor ;
7077 $ this ->processors = $ processors ;
78+ $ this ->excludedMethodsClassMap = $ excludedMethodsClassMap ;
7179 }
7280
7381 /**
7482 * Use class reflection on given data interface to build output data array
7583 *
7684 * @param mixed $dataObject
7785 * @param string $dataObjectType
78- * @param array $excludedMethods - list of methods to exclude from being called
7986 * @return array
8087 * @SuppressWarnings(PHPMD.CyclomaticComplexity)
8188 * @SuppressWarnings(PHPMD.NPathComplexity)
8289 */
83- public function buildOutputDataArray ($ dataObject , $ dataObjectType, array $ excludedMethods = [] )
90+ public function buildOutputDataArray ($ dataObject , $ dataObjectType )
8491 {
8592 $ methods = $ this ->methodsMapProcessor ->getMethodsMap ($ dataObjectType );
8693 $ outputData = [];
8794
95+ $ excludedMethodsForDataObjectType = $ this ->excludedMethodsClassMap [$ dataObjectType ] ?? [];
96+
8897 foreach (array_keys ($ methods ) as $ methodName ) {
89- if (in_array ($ methodName , $ excludedMethods )) {
98+ if (in_array ($ methodName , $ excludedMethodsForDataObjectType )) {
9099 continue ;
91100 }
92101
0 commit comments