Skip to content

Commit

Permalink
swap default number with first item in collection
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-rubel committed Nov 2, 2021
1 parent f4f72cc commit bbdccaa
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/Collection/LocaleNumberFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ class LocaleNumberFormatter implements Formatter
*/
public int $fraction_digits = 2;

/**
* Default number if $number_key isn't passed.
*
* @var float
*/
public float $default_number = 0;

/**
* Format the date and time.
*
Expand All @@ -65,7 +58,7 @@ public function format(Collection $items): string
);

return $formatter->format(
(float) $items->get($this->number_key) ?? $this->default_number
(float) $items->get($this->number_key) ?? $items->first()
);
}
}

0 comments on commit bbdccaa

Please sign in to comment.