1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: famoser |
5
|
|
|
* Date: 04.11.2016 |
6
|
|
|
* Time: 16:49 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Famoser\XKCDCache\Entities; |
10
|
|
|
|
11
|
|
|
/* |
12
|
|
|
CREATE TABLE 'applications' ( |
13
|
|
|
'id' INTEGER DEFAULT NULL PRIMARY KEY AUTOINCREMENT, |
14
|
|
|
'admin_id' INTEGER DEFAULT NULL REFERENCES 'frontend_users' ('id'), |
15
|
|
|
'name' TEXT DEFAULT NULL, |
16
|
|
|
'description' TEXT DEFAULT NULL, |
17
|
|
|
'application_id' TEST DEFAULT NULL, |
18
|
|
|
'application_seed' INT DEFAULT NULL, |
19
|
|
|
'release_date_time' TEXT DEFAULT NULL |
20
|
|
|
); |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
use Famoser\XKCDCache\Entities\Base\BaseEntity; |
24
|
|
|
use Famoser\XKCDCache\Types\Downloader; |
25
|
|
|
use Famoser\XKCDCache\Types\DownloadStatus; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* represents a comic from XKCD |
29
|
|
|
* @package Famoser\XKCDCache\Entities |
30
|
|
|
*/ |
31
|
|
|
class Comic extends BaseEntity |
32
|
|
|
{ |
33
|
|
|
/* @var int $status */ |
34
|
|
|
public $status; |
35
|
|
|
|
36
|
|
|
/* @var int $downloaded_by */ |
37
|
|
|
public $downloaded_by; |
38
|
|
|
|
39
|
|
|
/* @var string $status_message */ |
40
|
|
|
public $status_message; |
41
|
|
|
|
42
|
|
|
/* @var int $download_date_time type_of:timestamp */ |
43
|
|
|
public $download_date_time; |
44
|
|
|
|
45
|
|
|
/* @var string $filename */ |
46
|
|
|
public $filename; |
47
|
|
|
|
48
|
|
|
/* @var int $publish_date type_of:timestamp */ |
49
|
|
|
public $publish_date; |
50
|
|
|
|
51
|
|
|
/* @var int $id */ |
52
|
|
|
public $num; |
53
|
|
|
|
54
|
|
|
/* @var string $link */ |
55
|
|
|
public $link; |
56
|
|
|
|
57
|
|
|
/* @var string $news */ |
58
|
|
|
public $news; |
59
|
|
|
|
60
|
|
|
/* @var string $transcript */ |
61
|
|
|
public $transcript; |
62
|
|
|
|
63
|
|
|
/* @var string $safe_title */ |
64
|
|
|
public $safe_title; |
65
|
|
|
|
66
|
|
|
/* @var string $alt */ |
67
|
|
|
public $alt; |
68
|
|
|
|
69
|
|
|
/* @var string $img */ |
70
|
|
|
public $img; |
71
|
|
|
|
72
|
|
|
/* @var string $title */ |
73
|
|
|
public $title; |
74
|
|
|
|
75
|
|
|
/* @var string $json */ |
76
|
|
|
public $json; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* converts the status to text |
80
|
|
|
* |
81
|
|
|
* @return string |
82
|
|
|
*/ |
83
|
2 |
|
public function getStatusAsText() |
84
|
|
|
{ |
85
|
2 |
|
return DownloadStatus::toString($this->status); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* display the name of the downloader |
90
|
|
|
* |
91
|
|
|
* @return string |
92
|
|
|
*/ |
93
|
2 |
|
public function getDownloadedByAsText() |
94
|
|
|
{ |
95
|
2 |
|
return Downloader::toString($this->downloaded_by); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* get the name of the table from the database |
100
|
|
|
* |
101
|
|
|
* @return string |
102
|
|
|
*/ |
103
|
16 |
|
public function getTableName() |
104
|
|
|
{ |
105
|
16 |
|
return 'comics'; |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|