@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | return 1; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - $blackTorrentList = array_filter($torrentList, function ($torrent) use ($blacklist) { |
|
| 40 | + $blackTorrentList = array_filter($torrentList, function($torrent) use ($blacklist) { |
|
| 41 | 41 | return in_array($torrent[Torrent\Get::NAME], $blacklist); |
| 42 | 42 | }); |
| 43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $client->printTorrentsTable($blackTorrentList, $output); |
| 49 | 49 | $output->writeln('Total size: ' . $sizeInGb . ' Gb'); |
| 50 | 50 | |
| 51 | - $this->dryRun($input, $output, function () use ($logger) { |
|
| 51 | + $this->dryRun($input, $output, function() use ($logger) { |
|
| 52 | 52 | $logger->critical('actual delete not implemented!'); |
| 53 | 53 | //$client->removeTorrents($blackTorrentList, true); |
| 54 | 54 | }, 'dry-run, don\'t really remove'); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | $torrentsUrls = $this->getPopularTorrentsUrls($output, $weburgClient, $downloadDir); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $this->dryRun($input, $output, function () use ($weburgClient, $torrentsDir, $torrentsUrls) { |
|
| 45 | + $this->dryRun($input, $output, function() use ($weburgClient, $torrentsDir, $torrentsUrls) { |
|
| 46 | 46 | foreach ($torrentsUrls as $torrentUrl) { |
| 47 | 47 | $weburgClient->downloadTorrent($torrentUrl, $torrentsDir); |
| 48 | 48 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | return 0; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $this->dryRun($input, $output, function () use ($logger, $client, $obsoleteList) { |
|
| 35 | + $this->dryRun($input, $output, function() use ($logger, $client, $obsoleteList) { |
|
| 36 | 36 | $client->removeTorrents($obsoleteList); |
| 37 | 37 | $names = $client->getTorrentsField($obsoleteList, Torrent\Get::NAME); |
| 38 | 38 | $logger->info('Removed torrents:' . implode(', ', $names)); |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | $logger->debug('Send point: {point}', ['point' => $point]); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $this->dryRun($input, $output, function () use ($database, $points, $logger) { |
|
| 79 | + $this->dryRun($input, $output, function() use ($database, $points, $logger) { |
|
| 80 | 80 | $isSuccess = $database->writePoints($points, InfluxDB\Database::PRECISION_SECONDS); |
| 81 | 81 | $logger->info('InfluxDB write ' . ($isSuccess ? 'success' : 'failed')); |
| 82 | 82 | }, 'dry-run, don\'t really send points'); |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | $config->loadConfigFile(); |
| 59 | 59 | } catch (\RuntimeException $e) { |
| 60 | 60 | $logger->critical($e->getMessage()); |
| 61 | - $this->setCode(function () { |
|
| 61 | + $this->setCode(function() { |
|
| 62 | 62 | return 1; |
| 63 | 63 | }); |
| 64 | 64 | return; |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | $input->getOption('sort') |
| 85 | 85 | )) - 1; |
| 86 | 86 | |
| 87 | - usort($rowsSorted, function ($first, $second) use ($sortColumn) { |
|
| 87 | + usort($rowsSorted, function($first, $second) use ($sortColumn) { |
|
| 88 | 88 | return $first[$sortColumn] > $second[$sortColumn] ? 1 : -1; |
| 89 | 89 | }); |
| 90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $filters = $this->parseAgeFilter($filters['age']) + $filters; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - return array_filter($torrentList, function ($torrent) use ($filters) { |
|
| 96 | + return array_filter($torrentList, function($torrent) use ($filters) { |
|
| 97 | 97 | $age = $this->getTorrentAgeInDays($torrent); |
| 98 | 98 | if ($age < $filters['age_min'] || $age > $filters['age_max']) { |
| 99 | 99 | return false; |
@@ -133,8 +133,7 @@ discard block |
||
| 133 | 133 | public function getTorrentAgeInDays($torrent) |
| 134 | 134 | { |
| 135 | 135 | $date = isset($torrent[Torrent\Get::DONE_DATE]) && $torrent[Torrent\Get::DONE_DATE] ? |
| 136 | - $torrent[Torrent\Get::DONE_DATE] : |
|
| 137 | - (isset($torrent[Torrent\Get::ADDED_DATE]) ? $torrent[Torrent\Get::ADDED_DATE] : 0); |
|
| 136 | + $torrent[Torrent\Get::DONE_DATE] : (isset($torrent[Torrent\Get::ADDED_DATE]) ? $torrent[Torrent\Get::ADDED_DATE] : 0); |
|
| 138 | 137 | return $date ? round((time() - $date) / 86400) : 0; |
| 139 | 138 | } |
| 140 | 139 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | - * @param $url |
|
| 123 | + * @param string $url |
|
| 124 | 124 | * @param array $headers |
| 125 | 125 | * @return \Psr\Http\Message\StreamInterface |
| 126 | 126 | * @throws \RuntimeException |
@@ -175,6 +175,9 @@ discard block |
||
| 175 | 175 | . 'obj_id=' . $movieId; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | + /** |
|
| 179 | + * @param string $body |
|
| 180 | + */ |
|
| 178 | 181 | private function getMovieInfo($body) |
| 179 | 182 | { |
| 180 | 183 | $info = []; |
@@ -199,9 +202,9 @@ discard block |
||
| 199 | 202 | } |
| 200 | 203 | |
| 201 | 204 | /** |
| 202 | - * @param $body |
|
| 203 | - * @param $fromTimestamp |
|
| 204 | - * @return bool|string date if matched, false if not |
|
| 205 | + * @param \Psr\Http\Message\StreamInterface $body |
|
| 206 | + * @param integer $fromTimestamp |
|
| 207 | + * @return false|string date if matched, false if not |
|
| 205 | 208 | */ |
| 206 | 209 | private function checkTorrentDate($body, $fromTimestamp) |
| 207 | 210 | { |
@@ -222,7 +225,7 @@ discard block |
||
| 222 | 225 | } |
| 223 | 226 | |
| 224 | 227 | /** |
| 225 | - * @param $body |
|
| 228 | + * @param \Psr\Http\Message\StreamInterface $body |
|
| 226 | 229 | * @return array |
| 227 | 230 | */ |
| 228 | 231 | private function getTorrentsUrls($body) |
@@ -47,8 +47,8 @@ |
||
| 47 | 47 | ]; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $cleanedIds = array_map(function ($torrentId) { |
|
| 51 | - return (int)$torrentId; |
|
| 50 | + $cleanedIds = array_map(function($torrentId) { |
|
| 51 | + return (int) $torrentId; |
|
| 52 | 52 | }, $ids); |
| 53 | 53 | |
| 54 | 54 | $this->createSession(); |