1 | <?php |
||
2 | |||
3 | namespace mQueue\Model; |
||
4 | |||
5 | use mQueue\Model\Status as DefaultModelStatus; |
||
6 | use Zend_Date; |
||
7 | |||
8 | /** |
||
9 | * A status (link between movie and user with a rating) |
||
10 | */ |
||
11 | class Status extends AbstractModel |
||
12 | { |
||
13 | const Nothing = 0; |
||
14 | const Need = 1; |
||
15 | const Bad = 2; |
||
16 | const Ok = 3; |
||
17 | const Excellent = 4; |
||
18 | const Favorite = 5; |
||
19 | |||
20 | /** |
||
21 | * array of ratings names indexed by the rating value |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | public static $ratings = null; |
||
26 | |||
27 | /** |
||
28 | * Returns the unique ID for this status to be used in HTML |
||
29 | * |
||
30 | * @return string |
||
31 | */ |
||
32 | 1 | public function getUniqueId() |
|
33 | { |
||
34 | 1 | return Movie::paddedId($this->idMovie) . '_' . $this->idUser; |
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() The property
idUser does not exist on mQueue\Model\Status . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Returns the name |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | public function getName() |
||
43 | { |
||
44 | if ($this->rating == 0) { |
||
0 ignored issues
–
show
The property
rating does not exist on mQueue\Model\Status . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
45 | return _tr('Not rated'); |
||
46 | } |
||
47 | |||
48 | return self::$ratings[$this->rating]; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Returns the date of last update |
||
53 | * |
||
54 | * @return Zend_Date |
||
55 | */ |
||
56 | public function getDateUpdate() |
||
57 | { |
||
58 | return new Zend_Date($this->dateUpdate, Zend_Date::ISO_8601); |
||
0 ignored issues
–
show
The property
dateUpdate does not exist on mQueue\Model\Status . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
59 | } |
||
60 | } |
||
61 | |||
62 | // Defines ratings names |
||
63 | 1 | Status::$ratings = [ |
|
64 | 1 | DefaultModelStatus::Need => _tr('Need'), |
|
65 | 1 | DefaultModelStatus::Bad => _tr('Bad'), |
|
66 | 1 | DefaultModelStatus::Ok => _tr('Ok'), |
|
67 | 1 | DefaultModelStatus::Excellent => _tr('Excellent'), |
|
68 | 1 | DefaultModelStatus::Favorite => _tr('Favorite'), |
|
69 | ]; |
||
70 |