Let's take a look a MoneyQuery in a little more detail.
<?phpuseSonsOfPHP\Component\Money\Query\Currency\IsEqualToCurrencyQuery;useSonsOfPHP\Component\Money\Currency;$currency =Currency::USD();$currencyUSD =Currency::USD();$currencyJPY =Currency::JPY();// We create the new query and inject the dependencies$query =newIsEqualToCurrencyQuery($currency);// Both currencies have the same Currency Code, so we can say// they are equal$isEqual = $query->queryFrom($currencyUSD); // returns true// Another way to do the same thing is$isEqual = $currencyUSD->query($query); // returns true$isEqual = $currencyJPY->query($query); // returns false
Queries aren't just limited to bool type of results. Running a query can return any type of result. This means you could return an array or even a Generator.