magento2 – Gets the total amount of quote submission for each rule

I want to display each promotion name and total applied for the current quote in my basket / basket, I can display the name of each promo as follows:

$ quote = Mage :: getSingleton (& # 39; checkout / session & # 39;) -> getQuote ();
$ discountTotal = 0;
$ discount = array ();

foreach ($ quote-> getAllItems () as) {
if ($ item-> getAppliedRuleIds () == & # 39; || $ item-> getDiscountAmount () < 1) {
    continue;
  }
  $discountTotal += $item->getDiscountAmount ();
foreach (explode (",", $ item-> getAppliedRuleIds ()) as $ ruleId) {
$ rule = Mage :: getModel ('salesrule / rule') -> load ($ ruleId);
$ ruleName = $ rule-> getName ();
if (! empty ($ rule-> getCouponCode ())) {
$ ruleName = $ ruleName. & # 39; - & # 39 ;. $ rule-> getCouponCode (). & # 39;& # 39 ;;
}
if (array_key_exists ($ ruleName, $ discount)) {
$ discount[$ruleName] + = $ item-> getDiscountAmount ();
} else $ discounts[$ruleName] = $ item-> getDiscountAmount ();
}
}
return rebates $;

enter the description of the image here

But the total amount for each promo is wrong, how can I get the total for each promo applied in my quote