Hackathonners /
swap
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Judite\Presenters; |
||
| 4 | |||
| 5 | use NumberFormatter; |
||
| 6 | use Laracasts\Presenter\Presenter; |
||
| 7 | |||
| 8 | class CoursePresenter extends Presenter |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * The year of this course in ordinal format. |
||
| 12 | * |
||
| 13 | * @return string |
||
| 14 | */ |
||
| 15 | public function getOrdinalYear() |
||
| 16 | { |
||
| 17 | $formatter = new NumberFormatter(app()->getLocale(), NumberFormatter::SPELLOUT); |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 18 | $formatter->setTextAttribute(NumberFormatter::DEFAULT_RULESET, '%spellout-ordinal'); |
||
| 19 | |||
| 20 | return ucfirst($formatter->format($this->entity->year)); |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The semester of this course in ordinal format. |
||
| 25 | * |
||
| 26 | * @return string |
||
| 27 | */ |
||
| 28 | public function getOrdinalSemester() |
||
| 29 | { |
||
| 30 | $formatter = new NumberFormatter(app()->getLocale(), NumberFormatter::ORDINAL); |
||
| 31 | |||
| 32 | return ucfirst($formatter->format($this->entity->semester)); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |