Passed
Push — develop ( a18085...de8258 )
by Francisco
14:47
created

EnrollmentPresenter::inlineToString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Judite\Presenters;
4
5
use Laracasts\Presenter\Presenter;
6
7
class EnrollmentPresenter extends Presenter
8
{
9
    /**
10
     * Get the shift tag of this enrollment.
11
     *
12
     * @param string $placeholder
13
     *
14
     * @return string
15
     */
16
    public function getShiftTag($placeholder = '---')
17
    {
18
        return $this->entity->shift_id ? $this->entity->shift->tag : $placeholder;
19
    }
20
21
    /**
22
     * Get the formatted date of the last update of this enrollment.
23
     *
24
     * @return string
25
     */
26
    public function getUpdatedAt()
27
    {
28
        return $this->entity->updated_at->toDayDateTimeString();
29
    }
30
31
    /**
32
     * Get the string representation of the enrollment.
33
     *
34
     * @return string
35
     */
36
    public function inlineToString()
37
    {
38
        return $this->entity->student->user->name
39
            .' ('.$this->entity->student->student_number.')'
40
            .' - '.$this->getShiftTag()
41
            .' on '.$this->entity->course->name;
42
    }
43
}
44