@@ -67,32 +67,34 @@ public function __construct()
67
67
/**
68
68
* Add an additional filter
69
69
*
70
- * @param FilterInterface $filter
70
+ * @param FilterInterface ...$additionalFilter
71
71
*
72
72
* @return $this
73
73
*
74
74
* @throws InvalidFilterException
75
75
*/
76
- public function addFilter (FilterInterface $ filter ): self
76
+ public function addFilter (FilterInterface ... $ additionalFilter ): self
77
77
{
78
- $ this ->validateFilterCallback ($ filter ->getFilter (), "Invalid filter callback for filter {$ filter ->getToken ()}" );
79
-
80
- if ($ filter instanceof TransformingFilterInterface) {
81
- $ this ->validateFilterCallback (
82
- $ filter ->getSerializer (),
83
- "Invalid serializer callback for filter {$ filter ->getToken ()}"
84
- );
85
- }
78
+ foreach ($ additionalFilter as $ filter ) {
79
+ $ this ->validateFilterCallback ($ filter ->getFilter (), "Invalid filter callback for filter {$ filter ->getToken ()}" );
80
+
81
+ if ($ filter instanceof TransformingFilterInterface) {
82
+ $ this ->validateFilterCallback (
83
+ $ filter ->getSerializer (),
84
+ "Invalid serializer callback for filter {$ filter ->getToken ()}"
85
+ );
86
+ }
86
87
87
- foreach ($ filter ->getAcceptedTypes () as $ acceptedType ) {
88
- if (!in_array ($ acceptedType , ['integer ' , 'number ' , 'boolean ' , 'string ' , 'array ' , 'null ' ]) &&
89
- !class_exists ($ acceptedType )
90
- ) {
91
- throw new InvalidFilterException ('Filter accepts invalid types ' );
88
+ foreach ($ filter ->getAcceptedTypes () as $ acceptedType ) {
89
+ if (!in_array ($ acceptedType , ['integer ' , 'number ' , 'boolean ' , 'string ' , 'array ' , 'null ' ]) &&
90
+ !class_exists ($ acceptedType )
91
+ ) {
92
+ throw new InvalidFilterException ('Filter accepts invalid types ' );
93
+ }
92
94
}
93
- }
94
95
95
- $ this ->filter [$ filter ->getToken ()] = $ filter ;
96
+ $ this ->filter [$ filter ->getToken ()] = $ filter ;
97
+ }
96
98
97
99
return $ this ;
98
100
}
0 commit comments