This one is tricky.

$query can be an array - or an filename string
Technically it also support __toString() for objects, which should return the filename to query for
$fields can be an object or an array