File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -165,20 +165,20 @@ private function discoverThirdPartyPrimitives(string $primitiveType): array
165165 */
166166 private function filterPrimitives (array $ availablePrimitives , string $ type ): array
167167 {
168- $ collection = collect ($ availablePrimitives );
168+ $ excludeList = config ("boost.mcp. {$ type }.exclude " , []);
169+ $ includeList = config ("boost.mcp. {$ type }.include " , []);
169170
170- $ classStrings = $ collection -> filter ( fn ( $ item ): bool => is_string ( $ item ));
171- $ instances = $ collection -> reject ( fn ( $ item ): bool => is_string ( $ item)) ;
171+ $ filtered = collect ( $ availablePrimitives )-> reject ( function ( string | object $ item ) use ( $ excludeList ): bool {
172+ $ className = is_string ( $ item ) ? $ item : $ item::class ;
172173
173- $ filteredClassStrings = $ classStrings
174- ->diff (config ("boost.mcp. {$ type }.exclude " , []))
175- ->merge (
176- collect (config ("boost.mcp. {$ type }.include " , []))
177- ->filter (fn (string $ class ): bool => class_exists ($ class ))
178- );
174+ return in_array ($ className , $ excludeList , true );
175+ });
179176
180- return $ filteredClassStrings
181- ->merge ($ instances )
177+ $ explicitlyIncluded = collect ($ includeList )
178+ ->filter (fn (string $ class ): bool => class_exists ($ class ));
179+
180+ return $ filtered
181+ ->merge ($ explicitlyIncluded )
182182 ->values ()
183183 ->all ();
184184 }
You can’t perform that action at this time.
0 commit comments