Total Complexity | 11 |
Total Lines | 77 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
17 | class FanartTV |
||
18 | { |
||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | private $apiKey; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $server; |
||
28 | |||
29 | /** |
||
30 | * The constructor setting the config variables. |
||
31 | * |
||
32 | * @param $apiKey |
||
33 | */ |
||
34 | public function __construct($apiKey) |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Getting movie pictures. |
||
42 | * |
||
43 | * @param string $id |
||
44 | * |
||
45 | * @return array|false |
||
46 | */ |
||
47 | public function getMovieFanArt($id) |
||
48 | { |
||
49 | if ($this->apiKey !== '') { |
||
50 | $fanArt = $this->_getUrl('movies/'.$id); |
||
51 | if (! empty($fanArt) && $fanArt['status'] !== 'error') { |
||
52 | return $fanArt; |
||
53 | } |
||
54 | |||
55 | return false; |
||
56 | } |
||
57 | |||
58 | return false; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Getting tv show pictures. |
||
63 | * |
||
64 | * @param string $id |
||
65 | * @return array|false |
||
66 | */ |
||
67 | public function getTVFanart($id) |
||
68 | { |
||
69 | if ($this->apiKey !== '') { |
||
70 | $fanArt = $this->_getUrl('tv/'.$id); |
||
71 | if (! empty($fanArt) && $fanArt['status'] !== 'error') { |
||
72 | return $fanArt; |
||
73 | } |
||
74 | |||
75 | return false; |
||
76 | } |
||
77 | |||
78 | return false; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * The function making all the work using curl to call. |
||
83 | * |
||
84 | * @param string $path |
||
85 | * @return false|array |
||
86 | */ |
||
87 | private function _getUrl($path) |
||
94 | } |
||
95 | } |
||
96 |