@@ -30,7 +30,8 @@ |
||
30 | 30 | * |
31 | 31 | * @package nntmux |
32 | 32 | */ |
33 | -class API extends Capabilities { |
|
33 | +class API extends Capabilities |
|
34 | +{ |
|
34 | 35 | |
35 | 36 | /** DB class |
36 | 37 | * @var \nntmux\db\Settings |
@@ -14,7 +14,8 @@ |
||
14 | 14 | /** |
15 | 15 | * @param array $options |
16 | 16 | */ |
17 | - public function __construct(array $options = []) { |
|
17 | + public function __construct(array $options = []) |
|
18 | + { |
|
18 | 19 | $defaults = [ |
19 | 20 | 'Echo' => false, |
20 | 21 | 'Logger' => null, |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $con['esrb'] = (string)$amaz->Items->Item->ItemAttributes->ESRBAgeRating; |
502 | 502 | $con['releasedate'] = (string)$amaz->Items->Item->ItemAttributes->ReleaseDate; |
503 | 503 | |
504 | - if(!isset($con['releasedate'])){ |
|
504 | + if(!isset($con['releasedate'])) { |
|
505 | 505 | $con['releasedate'] = ""; |
506 | 506 | } |
507 | 507 | |
@@ -694,13 +694,13 @@ discard block |
||
694 | 694 | $con['cover'] |
695 | 695 | ) |
696 | 696 | ); |
697 | - if($con['cover'] === 1){ |
|
697 | + if($con['cover'] === 1) { |
|
698 | 698 | $con['cover'] = $ri->saveImage($consoleId, $con['coverurl'], $this->imgSavePath, 250, 250); |
699 | 699 | } |
700 | 700 | } else { |
701 | 701 | $consoleId = $check['id']; |
702 | 702 | |
703 | - if($con['cover'] === 1){ |
|
703 | + if($con['cover'] === 1) { |
|
704 | 704 | $con['cover'] = $ri->saveImage($consoleId, $con['coverurl'], $this->imgSavePath, 250, 250); |
705 | 705 | } |
706 | 706 | |
@@ -736,18 +736,12 @@ discard block |
||
736 | 736 | $apaiIo = new ApaiIO($conf); |
737 | 737 | |
738 | 738 | $response = $apaiIo->runOperation($search); |
739 | - if ($response === false) |
|
740 | - { |
|
739 | + if ($response === false) { |
|
741 | 740 | throw new \Exception("Could not connect to Amazon"); |
742 | - } |
|
743 | - else |
|
744 | - { |
|
745 | - if (isset($response->Items->Item->ItemAttributes->Title)) |
|
746 | - { |
|
741 | + } else { |
|
742 | + if (isset($response->Items->Item->ItemAttributes->Title)) { |
|
747 | 743 | return $response; |
748 | - } |
|
749 | - else |
|
750 | - { |
|
744 | + } else { |
|
751 | 745 | return false; |
752 | 746 | } |
753 | 747 | } |
@@ -95,14 +95,18 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * Fetch releases with requestid's from MySQL. |
97 | 97 | */ |
98 | - protected function _getReleases() { } |
|
98 | + protected function _getReleases() |
|
99 | + { |
|
100 | +} |
|
99 | 101 | |
100 | 102 | /** |
101 | 103 | * Process releases for requestid's. |
102 | 104 | * |
103 | 105 | * @return int How many did we rename? |
104 | 106 | */ |
105 | - protected function _processReleases() { } |
|
107 | + protected function _processReleases() |
|
108 | + { |
|
109 | +} |
|
106 | 110 | |
107 | 111 | /** |
108 | 112 | * No request id was found, update the release. |
@@ -129,7 +133,9 @@ discard block |
||
129 | 133 | * |
130 | 134 | * @return array|bool |
131 | 135 | */ |
132 | - protected function _getNewTitle() { } |
|
136 | + protected function _getNewTitle() |
|
137 | + { |
|
138 | +} |
|
133 | 139 | |
134 | 140 | /** |
135 | 141 | * Find a RequestID in a usenet subject. |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $ch = curl_init($this->directLink); |
113 | 113 | $this->directLink = ""; |
114 | 114 | } |
115 | - if ($usepost === true){ |
|
115 | + if ($usepost === true) { |
|
116 | 116 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
117 | 117 | curl_setopt($ch, CURLOPT_POST, 1); |
118 | 118 | curl_setopt($ch, CURLOPT_POSTFIELDS, $this->_postParams); |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | $results = array_merge($results, $this->covers()); |
190 | 190 | } |
191 | 191 | |
192 | - if (empty($results) === true){ |
|
192 | + if (empty($results) === true) { |
|
193 | 193 | return false; |
194 | - }else{ |
|
194 | + } else { |
|
195 | 195 | return $results; |
196 | 196 | } |
197 | 197 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | if ($ret = $this->_html->find('div#large_cover, img#cover', 1)) { |
315 | 315 | $this->_res['boxcover'] = trim($ret->src); |
316 | 316 | $this->_res['backcover'] = str_ireplace(".cover", ".back", trim($ret->src)); |
317 | - }else{ |
|
317 | + } else { |
|
318 | 318 | return false; |
319 | 319 | } |
320 | 320 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | return false; |
336 | 336 | } else { |
337 | 337 | if ($ret = $this->_html->find('h3[class=title]', 0)) { |
338 | - if ($ret->find('a[title]',0)){ |
|
338 | + if ($ret->find('a[title]',0)) { |
|
339 | 339 | $ret = $ret->find('a[title]', 0); |
340 | 340 | $title = trim($ret->title); |
341 | 341 | $title = preg_replace('/XXX/', '', $title); |
@@ -880,7 +880,8 @@ |
||
880 | 880 | if (preg_match('#\s+LIMIT\s+(?P<lower>\d+)(,\s+(?P<upper>\d+))?(;)?$#i', $query, $matches)) { |
881 | 881 | If (!isset($matches['upper']) && isset($matches['lower']) && $matches['lower'] == 1) { |
882 | 882 | // good it's already correctly set. |
883 | - } else { // We have a limit, but it's not for a single row |
|
883 | + } else { |
|
884 | +// We have a limit, but it's not for a single row |
|
884 | 885 | return false; |
885 | 886 | } |
886 | 887 |
@@ -182,7 +182,7 @@ |
||
182 | 182 | $this->setVideoNotFound(parent::PROCESS_TRAKT, $row['id']); |
183 | 183 | $this->titleCache[] = $release['cleanname']; |
184 | 184 | } |
185 | - } else{ |
|
185 | + } else { |
|
186 | 186 | //Processing failed, set the episode ID to the next processing group |
187 | 187 | $this->setVideoNotFound(parent::PROCESS_TRAKT, $row['id']); |
188 | 188 | $this->titleCache[] = $release['cleanname']; |
@@ -174,7 +174,8 @@ discard block |
||
174 | 174 | * @param $releaseId |
175 | 175 | * @param int $episodeId |
176 | 176 | */ |
177 | - public function setVideoIdFound($videoId, $releaseId, $episodeId) { |
|
177 | + public function setVideoIdFound($videoId, $releaseId, $episodeId) |
|
178 | + { |
|
178 | 179 | $this->pdo->queryExec( |
179 | 180 | sprintf(' |
180 | 181 | UPDATE releases |
@@ -804,7 +805,7 @@ discard block |
||
804 | 805 | |
805 | 806 | if (is_array($required)) { |
806 | 807 | foreach ($required as $req) { |
807 | - if (!in_array($type, ['tmdbS', 'tmdbE', 'traktS', 'traktE'])){ |
|
808 | + if (!in_array($type, ['tmdbS', 'tmdbE', 'traktS', 'traktE'])) { |
|
808 | 809 | if (!isset($array->$req)) { |
809 | 810 | return false; |
810 | 811 | } |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | * @return mixed|void |
468 | 468 | */ |
469 | 469 | public function parseTraktTv(&$data) |
470 | - { |
|
470 | + { |
|
471 | 471 | if (!isset($data['ids']['imdb']) || empty($data['ids']['imdb'])) { |
472 | 472 | return false; |
473 | 473 | } |
@@ -572,7 +572,8 @@ discard block |
||
572 | 572 | * @param array $values Array of keys/values to update. See $validKeys |
573 | 573 | * @return int|bool |
574 | 574 | */ |
575 | - public function update(array $values) { |
|
575 | + public function update(array $values) |
|
576 | + { |
|
576 | 577 | if (!count($values)) { |
577 | 578 | return false; |
578 | 579 | } |
@@ -776,8 +777,7 @@ discard block |
||
776 | 777 | */ |
777 | 778 | protected function fetchFanartTVProperties($imdbId) |
778 | 779 | { |
779 | - if ($this->fanartapikey != '') |
|
780 | - { |
|
780 | + if ($this->fanartapikey != '') { |
|
781 | 781 | $buffer = Utility::getUrl(['url' => 'https://webservice.fanart.tv/v3/movies/' . 'tt' . $imdbId . '?api_key=' . $this->fanartapikey , 'verifycert' => false]); |
782 | 782 | if ($buffer !== false) { |
783 | 783 | $art = json_decode($buffer, true); |