1: <?php
2: namespace Duyplus\TMDBApi\Classes\Data;
3:
4: class Genre
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 Genre
16: */
17: public function __construct($data)
18: {
19: $this->crawl = $data;
20: }
21:
22: //------------------------------------------------------------------------------
23: // Get Variables
24: //------------------------------------------------------------------------------
25:
26: /**
27: * Get the Genre's id
28: *
29: * @return int
30: */
31: public function getID()
32: {
33: return $this->crawl['id'];
34: }
35:
36: /**
37: * Get the Genre's name
38: *
39: * @return string
40: */
41: public function getName()
42: {
43: return $this->crawl['name'];
44: }
45:
46: /**
47: * Get Generic.<br>
48: * Get a item of the array, you should not get used to use this, better use specific get's.
49: *
50: * @param string $item The item of the $data array you want
51: * @return array|mixed|null Returns the entire data array, a specific item, or null if the item does not exist.
52: */
53: public function get($item = '')
54: {
55: if (empty($item)) {
56: return $this->crawl;
57: }
58: if (array_key_exists($item, $this->crawl)) {
59: return $this->crawl[$item];
60: }
61: return null;
62: }
63: }