1: <?php
2: namespace Duyplus\TMDBApi\Classes\Data;
3:
4: class Review
5: {
6: //------------------------------------------------------------------------------
7: // Class Variables
8: //------------------------------------------------------------------------------
9:
10: private $crawl;
11:
12: /**
13: * Construct Class
14: *
15: * @param array $data An array with the data of the Review
16: */
17: public function __construct($data)
18: {
19: $this->crawl = $data;
20: }
21:
22: //------------------------------------------------------------------------------
23: // Get Variables
24: //------------------------------------------------------------------------------
25:
26: /**
27: * Get the Review's id
28: *
29: * @return string
30: */
31: public function getID()
32: {
33: return $this->crawl['id'];
34: }
35:
36: /**
37: * Get the Review's author
38: *
39: * @return string
40: */
41: public function getAuthor()
42: {
43: return $this->crawl['author'];
44: }
45:
46: /**
47: * Get the Review's content
48: *
49: * @return string
50: */
51: public function getContent()
52: {
53: return $this->crawl['content'];
54: }
55:
56: /**
57: * Get the Review's url
58: *
59: * @return string
60: */
61: public function getUrl()
62: {
63: return $this->crawl['url'];
64: }
65:
66: /**
67: * Get Generic.<br>
68: * Get a item of the array, you should not get used to use this, better use specific get's.
69: *
70: * @param string $item The item of the $data array you want
71: * @return array|mixed|null Returns the entire data array, a specific item, or null if the item does not exist.
72: */
73: public function get($item = '')
74: {
75: if (empty($item)) {
76: return $this->crawl;
77: }
78: if (array_key_exists($item, $this->crawl)) {
79: return $this->crawl[$item];
80: }
81: return null;
82: }
83:
84: /**
85: * Get the JSON representation of the Review
86: *
87: * @return string
88: */
89: public function getJSON()
90: {
91: return json_encode($this->crawl, JSON_PRETTY_PRINT);
92: }
93: }