forked from deblan/t411-console
refactoring
This commit is contained in:
parent
e2acfcf68a
commit
08e6754e0e
|
@ -13,7 +13,7 @@ class Client
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->client = new GuzzleClient(array('base_url' => 'https://api.t411.me'));
|
$this->client = new GuzzleClient(['base_url' => 'https://api.t411.me']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAuthorization($username, $password)
|
public function getAuthorization($username, $password)
|
||||||
|
@ -48,9 +48,9 @@ class Client
|
||||||
public function searchTorrents($query, $options)
|
public function searchTorrents($query, $options)
|
||||||
{
|
{
|
||||||
$url = '/torrents/search/'.urlencode($query);
|
$url = '/torrents/search/'.urlencode($query);
|
||||||
$query = array();
|
$query = [];
|
||||||
|
|
||||||
foreach (array('offset', 'limit', 'cat') as $p) {
|
foreach (['offset', 'limit', 'cat'] as $p) {
|
||||||
if (!empty($options[$p])) {
|
if (!empty($options[$p])) {
|
||||||
$query[$p] = $options[$p];
|
$query[$p] = $options[$p];
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,6 @@ class ConfigLoader
|
||||||
|
|
||||||
public function getConfig()
|
public function getConfig()
|
||||||
{
|
{
|
||||||
return $this->configExists() ? Yaml::parse($this->configFile) : array();
|
return $this->configExists() ? Yaml::parse($this->configFile) : [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ class TorrentsSearchCommand extends Command
|
||||||
foreach ($terms as $term) {
|
foreach ($terms as $term) {
|
||||||
if (isset($termType['terms'][$term])) {
|
if (isset($termType['terms'][$term])) {
|
||||||
if (!isset($finalTerms[$termTypeId])) {
|
if (!isset($finalTerms[$termTypeId])) {
|
||||||
$finalTerms[$termTypeId] = array();
|
$finalTerms[$termTypeId] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($term, $finalTerms[$termTypeId])) {
|
if (!in_array($term, $finalTerms[$termTypeId])) {
|
||||||
|
|
Loading…
Reference in a new issue