Skip to content

Commit

Permalink
Merge pull request #349 from nezu-io/update-goute-to-version-4
Browse files Browse the repository at this point in the history
Update Goutte to version 4 removing the GuzzlePHP dependency
  • Loading branch information
irfan-dahir authored Jul 17, 2021
2 parents a0c1797 + 8a57e2e commit a290b79
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
},
"require": {
"fabpot/goutte": "^3.2",
"fabpot/goutte": "^4.0",
"php": "^7.4",
"ext-json": "*"
},
Expand Down
11 changes: 4 additions & 7 deletions src/MyAnimeList/MalClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

namespace Jikan\MyAnimeList;

use GuzzleHttp\Client as GuzzleClient;
use Jikan\Exception\BadResponseException;
use Jikan\Exception\ParserException;
use Jikan\Goutte\GoutteWrapper;
use Jikan\Model;
use Jikan\Parser;
use Jikan\Request;
use Symfony\Contracts\HttpClient\HttpClientInterface;

/**
* Class MalClient
Expand All @@ -32,16 +32,13 @@ class MalClient
/**
* MalClient constructor.
*
* @param GuzzleClient|null $guzzle
* @param HttpClientInterfac|null $httpClient
*
* @throws \InvalidArgumentException
*/
public function __construct(GuzzleClient $guzzle = null)
public function __construct(HttpClientInterface $httpClient = null)
{
$this->ghoutte = new GoutteWrapper();
if ($guzzle !== null) {
$this->ghoutte->setClient($guzzle);
}
$this->ghoutte = new GoutteWrapper($httpClient);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Parser/Forum/ForumTopicParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Jikan\Helper\Parser;
use Jikan\Model\Forum\ForumPost;
use Symfony\Component\DomCrawler\Crawler;
use function GuzzleHttp\Psr7\parse_query;

/**
* Class ForumPostParser
Expand Down Expand Up @@ -37,7 +36,7 @@ public function __construct(Crawler $crawler)
*/
public function getTopicId(): int
{
$query = parse_query(explode('?', $this->getUrl())[1]);
parse_str(explode('?', $this->getUrl())[1], $query);

return (int)$query['topicid'];
}
Expand Down

0 comments on commit a290b79

Please sign in to comment.