@@ -44,22 +44,22 @@ discard block |
||
44 | 44 | |
45 | 45 | $this->configFile = $configFile; |
46 | 46 | if (!isset($configFile)) { |
47 | - $this->configFile = self::getHomeDir() . '/.transmission-cli.yml'; |
|
47 | + $this->configFile = self::getHomeDir().'/.transmission-cli.yml'; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | 51 | public function loadConfigFile() |
52 | 52 | { |
53 | 53 | if (!file_exists($this->configFile)) { |
54 | - if ($this->configFile == self::getHomeDir() . '/.transmission-cli.yml') { |
|
54 | + if ($this->configFile == self::getHomeDir().'/.transmission-cli.yml') { |
|
55 | 55 | $this->saveConfigFile(); |
56 | 56 | } else { |
57 | - throw new \RuntimeException('Config file not found: ' . $this->configFile); |
|
57 | + throw new \RuntimeException('Config file not found: '.$this->configFile); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | $yml = Yaml::parse(file_get_contents($this->configFile)); |
61 | 61 | if (!is_array($yml)) { |
62 | - throw new \RuntimeException('Config file corrupted: ' . $this->configFile); |
|
62 | + throw new \RuntimeException('Config file corrupted: '.$this->configFile); |
|
63 | 63 | } |
64 | 64 | $this->config = $yml + $this->config; |
65 | 65 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $home = rtrim($home, '/'); |
107 | 107 | } elseif (!empty($_SERVER['HOMEDRIVE']) && !empty($_SERVER['HOMEPATH'])) { |
108 | 108 | // home on windows |
109 | - $home = $_SERVER['HOMEDRIVE'] . $_SERVER['HOMEPATH']; |
|
109 | + $home = $_SERVER['HOMEDRIVE'].$_SERVER['HOMEPATH']; |
|
110 | 110 | // If HOMEPATH is a root directory the path can end with a slash. Make sure |
111 | 111 | // that doesn't happen. |
112 | 112 | $home = rtrim($home, '\\/'); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function getLongVersion() |
68 | 68 | { |
69 | - if (('@' . 'git-version@') !== $this->getVersion()) { |
|
69 | + if (('@'.'git-version@') !== $this->getVersion()) { |
|
70 | 70 | return sprintf( |
71 | 71 | '<info>%s</info> version <comment>%s</comment> build <comment>%s</comment>', |
72 | 72 | $this->getName(), |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | '@git-commit@' |
75 | 75 | ); |
76 | 76 | } |
77 | - return '<info>' . $this->getName() . '</info> (repo)'; |
|
77 | + return '<info>'.$this->getName().'</info> (repo)'; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -87,7 +87,7 @@ |
||
87 | 87 | $data['rows'] = TableUtils::limitRows($data['rows'], $limit); |
88 | 88 | |
89 | 89 | $data['totals'] = [ |
90 | - 'Total: ' . count($data['rows']), |
|
90 | + 'Total: '.count($data['rows']), |
|
91 | 91 | '', |
92 | 92 | '', |
93 | 93 | self::sumArrayField($data['rows'], 3), |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | { |
61 | 61 | $filters = self::parseFilters($filters); |
62 | 62 | |
63 | - return array_filter($rows, function ($row) use ($filters) { |
|
63 | + return array_filter($rows, function($row) use ($filters) { |
|
64 | 64 | foreach ($filters as $columnKey => $filter) { |
65 | 65 | if (!isset($row[$columnKey])) { |
66 | - throw new \RuntimeException('Column ' . $columnKey . ' not exists, cannot filter'); |
|
66 | + throw new \RuntimeException('Column '.$columnKey.' not exists, cannot filter'); |
|
67 | 67 | } |
68 | 68 | $columnValue = $row[$columnKey]; |
69 | 69 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | if ((isset($filter['min']) && $value <= $filter['min']) || |
81 | 81 | (isset($filter['max']) && $value >= $filter['max']) || |
82 | 82 | (isset($filter['equals']) && $value != $filter['equals']) || |
83 | - (isset($filter['regex']) && !preg_match('/' . $filter['regex'] . '/i', $value)) |
|
83 | + (isset($filter['regex']) && !preg_match('/'.$filter['regex'].'/i', $value)) |
|
84 | 84 | ) { |
85 | 85 | return false; |
86 | 86 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | abs($columnNumber) |
101 | 101 | )) - 1; |
102 | 102 | |
103 | - usort($rowsSorted, function ($first, $second) use ($columnIndex, $sortOrder) { |
|
103 | + usort($rowsSorted, function($first, $second) use ($columnIndex, $sortOrder) { |
|
104 | 104 | return $first[$columnIndex] > $second[$columnIndex] ? $sortOrder : $sortOrder * -1; |
105 | 105 | }); |
106 | 106 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function getSeriesTorrents($movieId, $hashes, $daysMax = 1, $allowedMisses = 0) |
52 | 52 | { |
53 | 53 | $torrentsUrls = []; |
54 | - $timestampFrom = strtotime('-' . $daysMax . 'days'); |
|
54 | + $timestampFrom = strtotime('-'.$daysMax.'days'); |
|
55 | 55 | |
56 | 56 | $hashes = array_reverse($hashes); |
57 | 57 | foreach ($hashes as $hash) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | public function getMovieUrl($movieId) |
94 | 94 | { |
95 | - return 'http://weburg.net/movies/info/' . $movieId; |
|
95 | + return 'http://weburg.net/movies/info/'.$movieId; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | ]); |
112 | 112 | |
113 | 113 | if ($res->getStatusCode() != 200) { |
114 | - throw new \RuntimeException('Error ' . $res->getStatusCode() . 'while get url ' . $url); |
|
114 | + throw new \RuntimeException('Error '.$res->getStatusCode().'while get url '.$url); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | sleep($this->requestDelay); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | preg_match('/filename="(.*?)"/', $disposition[0], $res); |
148 | 148 | $filename = $res[1]; |
149 | 149 | |
150 | - $filePath = $torrentsDir . '/' . $filename; |
|
150 | + $filePath = $torrentsDir.'/'.$filename; |
|
151 | 151 | file_put_contents($filePath, $torrentBody); |
152 | 152 | |
153 | 153 | return $filePath; |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | private function getMovieTorrentUrl($movieId, $hash = '') |
175 | 175 | { |
176 | 176 | return 'http://weburg.net/ajax/download/movie?' |
177 | - . ($hash ? 'hash=' . $hash . '&' : '') |
|
178 | - . 'obj_id=' . $movieId; |
|
177 | + . ($hash ? 'hash='.$hash.'&' : '') |
|
178 | + . 'obj_id='.$movieId; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | private function getMovieInfo($body) |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | ]; |
192 | 192 | |
193 | 193 | foreach ($checks as $name => $regexp) { |
194 | - preg_match('/' . $regexp . '/mis', $body, $res); |
|
194 | + preg_match('/'.$regexp.'/mis', $body, $res); |
|
195 | 195 | $info[$name] = count($res) ? $res[1] : null; |
196 | 196 | } |
197 | 197 |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | try { |
91 | 91 | $databaseExists = $database->exists(); |
92 | 92 | } catch (ConnectException $e) { |
93 | - throw new \RuntimeException('InfluxDb connection error: ' . $e->getMessage()); |
|
93 | + throw new \RuntimeException('InfluxDb connection error: '.$e->getMessage()); |
|
94 | 94 | } |
95 | 95 | if (!$databaseExists) { |
96 | - $this->log('info', 'Database ' . $this->databaseName . ' not exists, creating'); |
|
96 | + $this->log('info', 'Database '.$this->databaseName.' not exists, creating'); |
|
97 | 97 | $database->create(null, false); |
98 | 98 | } |
99 | 99 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $points[] = $this->buildPoint($torrent, $transmissionHost); |
172 | 172 | } |
173 | 173 | $isSuccess = $this->writePoints($points); |
174 | - $this->log('info', 'InfluxDB write ' . ($isSuccess ? 'success' : 'failed')); |
|
174 | + $this->log('info', 'InfluxDB write '.($isSuccess ? 'success' : 'failed')); |
|
175 | 175 | return $isSuccess; |
176 | 176 | } |
177 | 177 | |
@@ -187,15 +187,15 @@ discard block |
||
187 | 187 | $where = []; |
188 | 188 | |
189 | 189 | if (isset($torrent[Torrent\Get::NAME])) { |
190 | - $where[] = "torrent_name = '" . $torrent[Torrent\Get::NAME] . "'"; |
|
190 | + $where[] = "torrent_name = '".$torrent[Torrent\Get::NAME]."'"; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | if ($transmissionHost) { |
194 | - $where[] = "host = '" . $transmissionHost . "'"; |
|
194 | + $where[] = "host = '".$transmissionHost."'"; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | if ($lastDays) { |
198 | - $fromTimestamp = strtotime('-' . $lastDays . ' days'); |
|
198 | + $fromTimestamp = strtotime('-'.$lastDays.' days'); |
|
199 | 199 | $fromDate = date('c', $fromTimestamp); |
200 | 200 | $where[] = "time >= '$fromDate'"; |
201 | 201 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $config->loadConfigFile(); |
61 | 61 | } catch (\RuntimeException $e) { |
62 | 62 | $logger->critical($e->getMessage()); |
63 | - $this->setCode(function () { |
|
63 | + $this->setCode(function() { |
|
64 | 64 | return 1; |
65 | 65 | }); |
66 | 66 | return; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $firstTransmission = $config->get('transmission')[0]; |
74 | 74 | $vars = ['host', 'port', 'user', 'password']; |
75 | 75 | foreach ($vars as $var) { |
76 | - $configName = 'transmission-' . $var; |
|
76 | + $configName = 'transmission-'.$var; |
|
77 | 77 | $config->set($configName, $this->getInputOption($input, $configName, $firstTransmission[$var])); |
78 | 78 | } |
79 | 79 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | $connect = ['host' => $host, 'port' => $port, 'user' => $user, 'password' => $password]; |
105 | 105 | |
106 | - $baseUri = 'http://' . $connect['host'] . ':' . $connect['port'] . '/transmission/rpc'; |
|
106 | + $baseUri = 'http://'.$connect['host'].':'.$connect['port'].'/transmission/rpc'; |
|
107 | 107 | $httpClient = new GuzzleHttp\Client(['base_uri' => $baseUri]); |
108 | 108 | |
109 | 109 | $api = new API\RpcClient($httpClient, $connect['user'], $connect['password'], $logger); |
@@ -44,8 +44,8 @@ |
||
44 | 44 | ]; |
45 | 45 | } |
46 | 46 | |
47 | - $cleanedIds = array_map(function ($torrentId) { |
|
48 | - return (int)$torrentId; |
|
47 | + $cleanedIds = array_map(function($torrentId) { |
|
48 | + return (int) $torrentId; |
|
49 | 49 | }, $ids); |
50 | 50 | |
51 | 51 | $this->getSessionId(); |