1
|
|
|
<?php declare(strict_types = 1); |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Tmdb package. |
4
|
|
|
* |
5
|
|
|
* (c) Vincent Faliès <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
* |
10
|
|
|
* @author Vincent Faliès <[email protected]> |
11
|
|
|
* @copyright Copyright (c) 2017 |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
|
15
|
|
|
namespace VfacTmdb; |
16
|
|
|
|
17
|
|
|
use VfacTmdb\Items; |
18
|
|
|
use VfacTmdb\Interfaces\TmdbInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Item class |
22
|
|
|
* @package Tmdb |
23
|
|
|
* @author Vincent Faliès <[email protected]> |
24
|
|
|
* @copyright Copyright (c) 2017 |
25
|
|
|
*/ |
26
|
|
|
class Item |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* Tmdb object |
30
|
|
|
* @var TmdbInterface |
31
|
|
|
*/ |
32
|
|
|
private $tmdb = null; |
33
|
|
|
/** |
34
|
|
|
* Logger object |
35
|
|
|
* @var \Psr\Log\LoggerInterface |
36
|
|
|
*/ |
37
|
|
|
private $logger = null; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Constructor |
41
|
|
|
* @param TmdbInterface $tmdb |
42
|
|
|
*/ |
43
|
|
|
|
44
|
24 |
|
public function __construct(TmdbInterface $tmdb) |
45
|
|
|
{ |
46
|
24 |
|
$this->tmdb = $tmdb; |
47
|
24 |
|
$this->logger = $tmdb->getLogger(); |
48
|
24 |
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Get movie details |
52
|
|
|
* @param int $movie_id |
53
|
|
|
* @param array $options |
54
|
|
|
* @return Items\Movie |
55
|
|
|
*/ |
56
|
3 |
|
public function getMovie(int $movie_id, array $options = array()) : Items\Movie |
57
|
|
|
{ |
58
|
3 |
|
$this->logger->debug('Starting getting movie', array('movie_id' => $movie_id, 'options' => $options)); |
59
|
3 |
|
$movie = new Items\Movie($this->tmdb, $movie_id, $options); |
60
|
|
|
|
61
|
3 |
|
return $movie; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Get collection details |
66
|
|
|
* @param int $collection_id |
67
|
|
|
* @param array $options |
68
|
|
|
* @return Items\Collection |
69
|
|
|
*/ |
70
|
3 |
|
public function getCollection(int $collection_id, array $options = array()) : Items\Collection |
71
|
|
|
{ |
72
|
3 |
|
$this->logger->debug('Starting getting collection', array('collection_id' => $collection_id, 'options' => $options)); |
73
|
3 |
|
$collection = new Items\Collection($this->tmdb, $collection_id, $options); |
74
|
|
|
|
75
|
3 |
|
return $collection; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Get TV Show details |
80
|
|
|
* @param int $tv_id |
81
|
|
|
* @param array $options |
82
|
|
|
* @return Items\TVShow |
83
|
|
|
*/ |
84
|
3 |
|
public function getTVShow(int $tv_id, array $options = array()) : Items\TVShow |
85
|
|
|
{ |
86
|
3 |
|
$this->logger->debug('Starting getting tvshow', array('tv_id' => $tv_id, 'options' => $options)); |
87
|
3 |
|
$tv = new Items\TVShow($this->tmdb, $tv_id, $options); |
88
|
|
|
|
89
|
3 |
|
return $tv; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Get TV Show episode details |
94
|
|
|
* @param int $tv_id |
95
|
|
|
* @param int $season_number |
96
|
|
|
* @param array $options |
97
|
|
|
* @return Items\TVSeason |
98
|
|
|
*/ |
99
|
3 |
|
public function getTVSeason(int $tv_id, int $season_number, array $options = array()) : Items\TVSeason |
100
|
|
|
{ |
101
|
3 |
|
$this->logger->debug('Starting getting tvseason', array('tv_id' => $tv_id, 'season_number' => $season_number, 'options' => $options)); |
102
|
3 |
|
$tvseason = new Items\TVSeason($this->tmdb, $tv_id, $season_number, $options); |
103
|
|
|
|
104
|
3 |
|
return $tvseason; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Get TV Show episode details |
109
|
|
|
* @param int $tv_id |
110
|
|
|
* @param int $season_number |
111
|
|
|
* @param int $episode_number |
112
|
|
|
* @param array $options |
113
|
|
|
* @return Items\TVEpisode |
114
|
|
|
*/ |
115
|
3 |
|
public function getTVEpisode(int $tv_id, int $season_number, int $episode_number, array $options = array()) : Items\TVEpisode |
116
|
|
|
{ |
117
|
3 |
|
$this->logger->debug('Starting getting tvepisode', array('tv_id' => $tv_id, 'season_number' => $season_number, 'episode_number' => $episode_number, 'options' => $options)); |
118
|
3 |
|
$tvepisode = new Items\TVEpisode($this->tmdb, $tv_id, $season_number, $episode_number, $options); |
119
|
|
|
|
120
|
3 |
|
return $tvepisode; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Get People details |
125
|
|
|
* @param int $people_id |
126
|
|
|
* @param array $options |
127
|
|
|
* @return Items\People |
128
|
|
|
*/ |
129
|
3 |
|
public function getPeople(int $people_id, array $options = array()) : Items\People |
130
|
|
|
{ |
131
|
3 |
|
$this->logger->debug('Starting getting people', array('people_id' => $people_id, 'options' => $options)); |
132
|
3 |
|
$people = new Items\People($this->tmdb, $people_id, $options); |
133
|
|
|
|
134
|
3 |
|
return $people; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Get Company details |
139
|
|
|
* @param int $company_id |
140
|
|
|
* @param array $options |
141
|
|
|
* @return Items\Company |
142
|
|
|
*/ |
143
|
3 |
|
public function getCompany(int $company_id, array $options = array()) : Items\Company |
144
|
|
|
{ |
145
|
3 |
|
$this->logger->debug('Starting getting company', array('company_id' => $company_id, 'options' => $options)); |
146
|
3 |
|
$company = new Items\Company($this->tmdb, $company_id, $options); |
147
|
|
|
|
148
|
3 |
|
return $company; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* Get TV Network details |
153
|
|
|
* @param int $network_id |
154
|
|
|
* @param array $options |
155
|
|
|
* @return Items\TVNetwork |
156
|
|
|
* @author Steve Richter <[email protected]> |
157
|
|
|
*/ |
158
|
3 |
|
public function getTVNetwork(int $network_id, array $options = array()) : Items\TVNetwork |
159
|
|
|
{ |
160
|
3 |
|
$this->logger->debug('Starting getting tvnetwork', array('network_id' => $network_id, 'options' => $options)); |
161
|
3 |
|
$tvnetwork = new Items\TVNetwork($this->tmdb, $network_id, $options); |
162
|
|
|
|
163
|
3 |
|
return $tvnetwork; |
164
|
|
|
} |
165
|
|
|
} |
166
|
|
|
|