1 | <?php declare(strict_types=1); |
||
27 | abstract class Account |
||
28 | { |
||
29 | use GeneratorTrait; |
||
30 | |||
31 | /** |
||
32 | * Tmdb object |
||
33 | * @var TmdbInterface |
||
34 | */ |
||
35 | protected $tmdb = null; |
||
36 | /** |
||
37 | * Logger |
||
38 | * @var \Psr\Log\LoggerInterface |
||
39 | */ |
||
40 | protected $logger = null; |
||
41 | /** |
||
42 | * Session_id string |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $auth = null; |
||
46 | /** |
||
47 | * Account id |
||
48 | * @var int |
||
49 | */ |
||
50 | protected $account_id; |
||
51 | /** |
||
52 | * Configuration array |
||
53 | * @var \stdClass |
||
54 | */ |
||
55 | protected $conf = null; |
||
56 | /** |
||
57 | * Options |
||
58 | * @var array |
||
59 | */ |
||
60 | protected $options = []; |
||
61 | |||
62 | /** |
||
63 | * Page number |
||
64 | * @var int |
||
65 | */ |
||
66 | public $page = 1; |
||
67 | /** |
||
68 | * Total pages |
||
69 | * @var int |
||
70 | */ |
||
71 | public $total_pages = 1; |
||
72 | /** |
||
73 | * Total results |
||
74 | * @var int |
||
75 | */ |
||
76 | public $total_results = 0; |
||
77 | |||
78 | /** |
||
79 | * Constructor |
||
80 | * @param TmdbInterface $tmdb |
||
81 | * @param string $session_id |
||
82 | * @param int $account_id |
||
83 | * @param array $options |
||
84 | */ |
||
85 | 28 | public function __construct(TmdbInterface $tmdb, string $session_id, int $account_id, array $options = array()) |
|
96 | |||
97 | /** |
||
98 | * Add or remove item in list |
||
99 | * @param string $list_type Type of list (possible value : favorite / watchlist) |
||
100 | * @param string $media_type type of media (movie / tv) |
||
101 | * @param int $media_id media_id |
||
102 | * @param bool $add add or remove item in list |
||
103 | */ |
||
104 | 10 | protected function setListItem(string $list_type, string $media_type, int $media_id, bool $add) |
|
119 | |||
120 | /** |
||
121 | * Get account favorite items |
||
122 | * @param string $list_type type of list (possible value : favorite, rated, watchlist) |
||
123 | * @param string $item item name, possible value : movies , tv , tv/episodes |
||
124 | * @param string $result_class class for the results |
||
125 | * @return \Generator |
||
126 | */ |
||
127 | 7 | protected function getAccountListItems(string $list_type, string $item, string $result_class) : \Generator |
|
137 | |||
138 | /** |
||
139 | * Get page from result search |
||
140 | * @return int |
||
141 | */ |
||
142 | public function getPage() : int |
||
146 | |||
147 | /** |
||
148 | * Get total page from result search |
||
149 | * @return int |
||
150 | */ |
||
151 | public function getTotalPages() : int |
||
155 | |||
156 | /** |
||
157 | * Get total results from search |
||
158 | * @return int |
||
159 | */ |
||
160 | public function getTotalResults() : int |
||
164 | } |
||
165 |