Completed
Push — master ( 9492ba...5fed73 )
by Stanislav
306:28
created
src/Helpers/TorrentUtils.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
     public static function getTorrentAge($torrent)
14 14
     {
15 15
         $date = isset($torrent[Torrent\Get::DONE_DATE]) && $torrent[Torrent\Get::DONE_DATE] ?
16
-            $torrent[Torrent\Get::DONE_DATE] :
17
-            (isset($torrent[Torrent\Get::ADDED_DATE]) ? $torrent[Torrent\Get::ADDED_DATE] : 0);
16
+            $torrent[Torrent\Get::DONE_DATE] : (isset($torrent[Torrent\Get::ADDED_DATE]) ? $torrent[Torrent\Get::ADDED_DATE] : 0);
18 17
         return $date ? time() - $date : 0;
19 18
     }
20 19
 
Please login to merge, or discard this patch.
src/Command/TorrentRemove.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         if (count($notExistsIds)) {
62 62
             foreach ($notExistsIds as $notExistsId) {
63
-                $output->writeln($notExistsId . ' not exists');
63
+                $output->writeln($notExistsId.' not exists');
64 64
             }
65 65
             return 1;
66 66
         }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             }
78 78
         }
79 79
 
80
-        $this->dryRun($input, $output, function () use ($config, $torrentList, $client, $input, $output) {
80
+        $this->dryRun($input, $output, function() use ($config, $torrentList, $client, $input, $output) {
81 81
             $influxDbClient = $this->getApplication()->getInfluxDbClient(
82 82
                 $config->get('influxdb-host'),
83 83
                 $config->get('influxdb-port'),
Please login to merge, or discard this patch.
src/Command/StatsGet.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
                 $config->get('influxdb-database')
86 86
             );
87 87
 
88
-            $lastDays = (int)$input->getOption('days') ? (int)$input->getOption('days') : 0;
89
-            $limit = (int)$input->getOption('limit') ? (int)$input->getOption('limit') : 0;
88
+            $lastDays = (int) $input->getOption('days') ? (int) $input->getOption('days') : 0;
89
+            $limit = (int) $input->getOption('limit') ? (int) $input->getOption('limit') : 0;
90 90
 
91 91
             $torrentList = $client->getTorrentData();
92 92
 
93
-            $torrentList = array_map(function ($torrent) {
93
+            $torrentList = array_map(function($torrent) {
94 94
                 $torrent['age'] = TorrentUtils::getTorrentAgeInDays($torrent);
95 95
                 return $torrent;
96 96
             }, $torrentList);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
             $transmissionHost = $config->get('transmission-host');
104 104
 
105
-            $torrentList = array_map(function ($torrent) use ($influxDbClient, $transmissionHost, $lastDays) {
105
+            $torrentList = array_map(function($torrent) use ($influxDbClient, $transmissionHost, $lastDays) {
106 106
                 $torrent['uploaded'] = $influxDbClient->getTorrentSum(
107 107
                     $torrent,
108 108
                     'uploaded_last',
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         TableUtils::printTable($tableData, $output);
133 133
 
134 134
         $freeSpace = $client->getFreeSpace();
135
-        $output->writeln('Free space: ' . TorrentUtils::getSizeInGb($freeSpace) . ' GB');
135
+        $output->writeln('Free space: '.TorrentUtils::getSizeInGb($freeSpace).' GB');
136 136
 
137 137
         if ($input->getOption('rm')) {
138 138
             return $this->removeTorrents($input, $output, $tableData['rows']);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             'headers' => ['Name', 'Id', 'Age, days', 'Size, GB', 'Uploaded, GB', 'Per day, GB', 'Profit, %'],
181 181
             'rows' => $rows,
182 182
             'totals' => [
183
-                'Total: ' . count($rows),
183
+                'Total: '.count($rows),
184 184
                 '',
185 185
                 '',
186 186
                 TorrentListUtils::sumArrayField($rows, 3),
Please login to merge, or discard this patch.
src/Command/TorrentAdd.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,13 +50,13 @@
 block discarded – undo
50 50
 
51 51
     private function addFile(InputInterface $input, OutputInterface $output, TransmissionClient $client, $torrentFile)
52 52
     {
53
-        $this->dryRun($input, $output, function () use ($torrentFile, $client, $input, $output) {
53
+        $this->dryRun($input, $output, function() use ($torrentFile, $client, $input, $output) {
54 54
             $torrentAdded = $client->addTorrent($torrentFile);
55 55
             if ($torrentAdded) {
56 56
                 if (isset($torrentAdded['duplicate'])) {
57
-                    $output->writeln($torrentFile . ' was not added. Probably it was added before.');
57
+                    $output->writeln($torrentFile.' was not added. Probably it was added before.');
58 58
                 } else {
59
-                    $output->writeln($torrentFile . ' added. Waiting for Transmission...');
59
+                    $output->writeln($torrentFile.' added. Waiting for Transmission...');
60 60
                     $client->waitForTransmission(10);
61 61
                 }
62 62
             }
Please login to merge, or discard this patch.
src/Command/Docs.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
             $command = $this->getApplication()->find($commandName);
46 46
             $help = $command->getRawHelp();
47 47
 
48
-            $output->writeln($help . "\n\n");
48
+            $output->writeln($help."\n\n");
49 49
         }
50 50
     }
51 51
 }
Please login to merge, or discard this patch.
src/Command/TorrentList.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
         $torrentList = $client->getTorrentData();
93 93
 
94
-        $torrentList = array_map(function ($torrent) {
94
+        $torrentList = array_map(function($torrent) {
95 95
             $torrent['age'] = TorrentUtils::getTorrentAgeInDays($torrent);
96 96
             return $torrent;
97 97
         }, $torrentList);
@@ -109,6 +109,6 @@  discard block
 block discarded – undo
109 109
         );
110 110
 
111 111
         $freeSpace = $client->getFreeSpace();
112
-        $output->writeln('Free space: ' . TorrentUtils::getSizeInGb($freeSpace) . ' GB');
112
+        $output->writeln('Free space: '.TorrentUtils::getSizeInGb($freeSpace).' GB');
113 113
     }
114 114
 }
Please login to merge, or discard this patch.
src/Config.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,22 +44,22 @@  discard block
 block discarded – undo
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
 block discarded – undo
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, '\\/');
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/InfluxDbClient.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.