app\helpers\Utility::totalOrder PHP Метод

totalOrder() публичный статический Метод

totalOrder It is able to return the order total, as items number and price total.
public static totalOrder ( [object] $items ) : [array]
$items [object]
Результат [array]
    public static function totalOrder($items)
    {
        $data = ['qty' => 0, 'total' => 0];
        $items->each(function ($item, $key) use(&$data) {
            $data['qty'] += $item->quantity;
            $data['total'] += $item->price;
        });
        return $data;
    }