diff --git a/.php_cs.dist b/.php_cs.dist index bdeb415..f17054e 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -27,7 +27,6 @@ return PhpCsFixer\Config::create() 'fopen_flags' => false, 'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'], 'linebreak_after_opening_tag' => true, - 'mb_str_functions' => true, 'no_php4_constructor' => true, 'no_unreachable_default_argument_value' => true, 'no_useless_else' => true, @@ -45,4 +44,4 @@ return PhpCsFixer\Config::create() 'strict_param' => true, ]) ->setFinder($finder) -; \ No newline at end of file +; diff --git a/src/Client/GuzzleClient.php b/src/Client/GuzzleClient.php index 8f50005..97fdb16 100644 --- a/src/Client/GuzzleClient.php +++ b/src/Client/GuzzleClient.php @@ -18,6 +18,7 @@ use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\HandlerStack; +use GuzzleHttp\RequestOptions; use Psr\Http\Message\ResponseInterface; use Symfony\Component\DomCrawler\Crawler; use Wa72\HtmlPageDom\HtmlPage; @@ -70,6 +71,22 @@ public function getGuzzleResponse( } } + /** + * {@inheritdoc} + * + * @throws GuzzleClientException + */ + public function writeGuzzleResponseToFile( + string $uri, + string $filename, + array $options = [], + string $method = self::METHOD_GET + ): ResponseInterface { + return $this->getGuzzleResponse($uri, $options + [ + RequestOptions::SINK => $filename, + ], $method); + } + /** * {@inheritdoc} * diff --git a/src/Client/GuzzleClientInterface.php b/src/Client/GuzzleClientInterface.php index 52236b3..909dd51 100644 --- a/src/Client/GuzzleClientInterface.php +++ b/src/Client/GuzzleClientInterface.php @@ -119,6 +119,21 @@ public function getGuzzleResponse( string $method = self::METHOD_GET ): ResponseInterface; + /** + * @param string $uri + * @param string $filename + * @param array $options + * @param string $method + * + * @return ResponseInterface + */ + public function writeGuzzleResponseToFile( + string $uri, + string $filename, + array $options = [], + string $method = self::METHOD_GET + ): ResponseInterface; + /** * @param string $uri * @param array $options diff --git a/src/Formatter/GuzzleMessageFormatter.php b/src/Formatter/GuzzleMessageFormatter.php index caaccce..7aa30e2 100644 --- a/src/Formatter/GuzzleMessageFormatter.php +++ b/src/Formatter/GuzzleMessageFormatter.php @@ -20,7 +20,7 @@ class GuzzleMessageFormatter extends MessageFormatter protected const CREDENTIAL_REPLACEMENT = '******'; /** @var string[] */ - protected $credentialsToReplace; + protected $credentialsToReplace = []; /** * @param string[] $credentialsToReplace