diff --git a/src/Api/Client.php b/src/Api/Client.php index 219b1bf..03383e5 100644 --- a/src/Api/Client.php +++ b/src/Api/Client.php @@ -112,8 +112,8 @@ class Client return new ClientResponse($this->client->{$method}($uri, $options)); } catch (RequestException $e) { throw new ClientException(sprintf('Request exception (%s): %s', strtoupper($method), $e->getMessage())); - } catch (HttpConnectException $e) { - throw new ClientException(sprintf('HTTP Connection exception: %s', $e->getMessage())); + } catch (\Exception $e) { + throw new ClientException(sprintf('Exception: %s', $e->getMessage())); } } } diff --git a/src/Console/Command/AuthLoginCommand.php b/src/Console/Command/AuthLoginCommand.php index c4a1a6f..c0646e3 100644 --- a/src/Console/Command/AuthLoginCommand.php +++ b/src/Console/Command/AuthLoginCommand.php @@ -7,6 +7,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Api\ConfigLoader; use Api\Client; +use Api\ClientException; class AuthLoginCommand extends Command { diff --git a/src/Console/Command/CategoriesTreeCommand.php b/src/Console/Command/CategoriesTreeCommand.php index f2f6f10..cb80a6c 100644 --- a/src/Console/Command/CategoriesTreeCommand.php +++ b/src/Console/Command/CategoriesTreeCommand.php @@ -7,6 +7,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Api\Client; use Api\ConfigLoader; +use Api\ClientException; class CategoriesTreeCommand extends Command { diff --git a/src/Console/Command/TorrentsDetailsCommand.php b/src/Console/Command/TorrentsDetailsCommand.php index 1c55df1..20ef329 100644 --- a/src/Console/Command/TorrentsDetailsCommand.php +++ b/src/Console/Command/TorrentsDetailsCommand.php @@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Command\Command; use Api\Client; use Api\ConfigLoader; +use Api\ClientException; class TorrentsDetailsCommand extends Command { diff --git a/src/Console/Command/TorrentsDownloadCommand.php b/src/Console/Command/TorrentsDownloadCommand.php index a5faa4c..328cc0b 100644 --- a/src/Console/Command/TorrentsDownloadCommand.php +++ b/src/Console/Command/TorrentsDownloadCommand.php @@ -10,6 +10,7 @@ use Api\Client; use Api\ConfigLoader; use GuzzleHttp\Exception\ParseException; use Symfony\Component\Filesystem\Filesystem; +use Api\ClientException; class TorrentsDownloadCommand extends Command { diff --git a/src/Console/Command/TorrentsSearchCommand.php b/src/Console/Command/TorrentsSearchCommand.php index 1f8954b..2b17c79 100644 --- a/src/Console/Command/TorrentsSearchCommand.php +++ b/src/Console/Command/TorrentsSearchCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Command\Command; use Api\Client; use Api\ConfigLoader; use Api\ClientResponse; +use Api\ClientException; class TorrentsSearchCommand extends Command { diff --git a/src/Console/Command/TorrentsTopCommand.php b/src/Console/Command/TorrentsTopCommand.php index ed1ac18..7123d82 100644 --- a/src/Console/Command/TorrentsTopCommand.php +++ b/src/Console/Command/TorrentsTopCommand.php @@ -9,6 +9,7 @@ use Symfony\Component\Console\Command\Command; use Api\Client; use Api\ConfigLoader; use Api\ClientResponse; +use Api\ClientException; class TorrentsTopCommand extends Command { diff --git a/src/Console/Command/TypesTreeCommand.php b/src/Console/Command/TypesTreeCommand.php index 19dc2da..2839081 100644 --- a/src/Console/Command/TypesTreeCommand.php +++ b/src/Console/Command/TypesTreeCommand.php @@ -8,6 +8,7 @@ use Symfony\Component\Console\Command\Command; use Api\Client; use Api\ConfigLoader; use Symfony\Component\Console\Input\InputOption; +use Api\ClientException; class TypesTreeCommand extends Command { diff --git a/src/Console/Command/UsersProfileCommand.php b/src/Console/Command/UsersProfileCommand.php index 1004e09..996f164 100644 --- a/src/Console/Command/UsersProfileCommand.php +++ b/src/Console/Command/UsersProfileCommand.php @@ -8,6 +8,7 @@ use Symfony\Component\Console\Command\Command; use Api\Client; use Api\ConfigLoader; use Symfony\Component\Console\Input\InputOption; +use Api\ClientException; class UsersProfileCommand extends Command { @@ -91,6 +92,6 @@ Usage: users:profile [OPTIONS]"); $sizes = 'BKMGTP'; $factor = floor((strlen($bytes) - 1) / 3); - return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sizes[$factor]; + return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)).$sizes[$factor]; } } diff --git a/src/Transmission/Command/TransmissionConfigureCommand.php b/src/Transmission/Command/TransmissionConfigureCommand.php index 025574b..ef30de4 100644 --- a/src/Transmission/Command/TransmissionConfigureCommand.php +++ b/src/Transmission/Command/TransmissionConfigureCommand.php @@ -4,8 +4,6 @@ namespace Transmission\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Command\Command; use Api\ConfigLoader; diff --git a/src/Transmission/Command/TransmissionDownloadCommand.php b/src/Transmission/Command/TransmissionDownloadCommand.php index 5d05a3c..f6d671e 100644 --- a/src/Transmission/Command/TransmissionDownloadCommand.php +++ b/src/Transmission/Command/TransmissionDownloadCommand.php @@ -49,7 +49,7 @@ Usage: transmission:download TORRENT_ID"); $options = []; - if (!empty($config['username']) and !empty($config['password'])) { + if (!empty($config['username']) && !empty($config['password'])) { $options = array( 'request.options' => array( 'auth' => array($config['username'], $config['password']) @@ -66,7 +66,7 @@ Usage: transmission:download TORRENT_ID"); $content = base64_encode(file_get_contents($outputFile)); - $torrent = $transmission->add($content, true); + $transmission->add($content, true); } catch (\Exception $e) { unlink($outputFile);