/** * Calculates client's orders total value * * @param ClientInterface $client * * @return int|float */ protected function calculateOrdersAmountForClient(ClientInterface $client) { $total = 0; $client->getOrders()->map(function (OrderInterface $order) use(&$total) { $total += $this->convertAmount($order); }); return $total; }