1: | <?php |
2: | namespace duyplus\tmdbapi\classes\data; |
3: | |
4: | /** |
5: | * This class handles all the data you can get from the api Configuration |
6: | * |
7: | * @package TMDB_V3_API_PHP |
8: | * @author Alvaro Octal |
9: | * @version 0.7 |
10: | * @date 20/01/2015 |
11: | * @updated 31/12/2024 |
12: | * @link https://github.com/duyplus/tmdbapi |
13: | * @copyright Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php) |
14: | */ |
15: | |
16: | class Review |
17: | { |
18: | //------------------------------------------------------------------------------ |
19: | // Class Variables |
20: | //------------------------------------------------------------------------------ |
21: | |
22: | private $_data; |
23: | |
24: | /** |
25: | * Construct Class |
26: | * |
27: | * @param array $data An array with the data of a Review |
28: | */ |
29: | public function __construct($data) |
30: | { |
31: | $this->_data = $data; |
32: | } |
33: | |
34: | //------------------------------------------------------------------------------ |
35: | // Get Variables |
36: | //------------------------------------------------------------------------------ |
37: | |
38: | /** |
39: | * Get the Review's id |
40: | * |
41: | * @return int |
42: | **/ |
43: | public function getID() |
44: | { |
45: | return $this->_data['id']; |
46: | } |
47: | |
48: | /** |
49: | * Get the Review's author |
50: | * |
51: | * @return string |
52: | */ |
53: | public function getAuthor() |
54: | { |
55: | return $this->_data['author']; |
56: | } |
57: | |
58: | /** |
59: | * Get the Review's content |
60: | * |
61: | * @return string |
62: | */ |
63: | public function getContent() |
64: | { |
65: | return $this->_data['content']; |
66: | } |
67: | |
68: | /** |
69: | * Get the Review's url |
70: | * |
71: | * @return string |
72: | */ |
73: | public function getURL() |
74: | { |
75: | return $this->_data['url']; |
76: | } |
77: | |
78: | /** |
79: | * Get Generic.<br> |
80: | * Get a item of the array, you should not get used to use this, better use specific get's. |
81: | * |
82: | * @param string $item The item of the $data array you want |
83: | * @return array |
84: | */ |
85: | public function get($item = '') |
86: | { |
87: | return (empty($item)) ? $this->_data : $this->_data[$item]; |
88: | } |
89: | |
90: | //------------------------------------------------------------------------------ |
91: | // Export |
92: | //------------------------------------------------------------------------------ |
93: | |
94: | /** |
95: | * Get the JSON representation of the Movie |
96: | * |
97: | * @return string |
98: | */ |
99: | public function getJSON() |
100: | { |
101: | return json_encode($this->_data, JSON_PRETTY_PRINT); |
102: | } |
103: | } |
104: | ?> |