1 | <?php |
||
7 | class Status extends AbstractModel |
||
8 | { |
||
9 | /** |
||
10 | * @var integer |
||
11 | */ |
||
12 | const STATUS_STOPPED = 0; |
||
13 | |||
14 | /** |
||
15 | * @var integer |
||
16 | */ |
||
17 | const STATUS_CHECK_WAIT = 1; |
||
18 | |||
19 | /** |
||
20 | * @var integer |
||
21 | */ |
||
22 | const STATUS_CHECK = 2; |
||
23 | |||
24 | /** |
||
25 | * @var integer |
||
26 | */ |
||
27 | const STATUS_DOWNLOAD_WAIT = 3; |
||
28 | |||
29 | /** |
||
30 | * @var integer |
||
31 | */ |
||
32 | const STATUS_DOWNLOAD = 4; |
||
33 | |||
34 | /** |
||
35 | * @var integer |
||
36 | */ |
||
37 | const STATUS_SEED_WAIT = 5; |
||
38 | |||
39 | /** |
||
40 | * @var integer |
||
41 | */ |
||
42 | const STATUS_SEED = 6; |
||
43 | |||
44 | /** |
||
45 | * @var integer |
||
46 | */ |
||
47 | protected $status; |
||
48 | |||
49 | /** |
||
50 | * @param integer|Status $status |
||
51 | */ |
||
52 | public function __construct($status) |
||
53 | { |
||
54 | if ($status instanceof self) { |
||
55 | $this->status = $status->getValue(); |
||
56 | } else { |
||
57 | $this->status = (integer) $status; |
||
58 | } |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return integer |
||
63 | */ |
||
64 | public function getValue() |
||
68 | |||
69 | /** |
||
70 | * @return boolean |
||
71 | */ |
||
72 | public function isStopped() |
||
76 | |||
77 | /** |
||
78 | * @return boolean |
||
79 | */ |
||
80 | public function isChecking() |
||
85 | |||
86 | /** |
||
87 | * @return boolean |
||
88 | */ |
||
89 | public function isDownloading() |
||
94 | |||
95 | /** |
||
96 | * @return boolean |
||
97 | */ |
||
98 | public function isSeeding() |
||
103 | } |
||
104 |