Cleanup cookie jar

As of latest Guzzle release, it's fixed so we can removed that code.
This commit is contained in:
Jeremy Benoist 2020-03-29 11:39:49 +02:00
parent c9b83a13c0
commit b12e23ad8a
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C

View file

@ -9,7 +9,6 @@ use Psr\Log\LoggerInterface;
/**
* Overidden Cookie behavior to:
* - fix multiple concurrent writes (see https://github.com/guzzle/guzzle/pull/1884)
* - ignore error when the cookie file is malformatted (resulting in clearing it).
*/
class FileCookieJar extends BaseFileCookieJar
@ -27,29 +26,6 @@ class FileCookieJar extends BaseFileCookieJar
$this->logger = $logger;
}
/**
* Saves the cookies to a file.
*
* @param string $filename File to save
*
* @throws \RuntimeException if the file cannot be found or created
*/
public function save($filename)
{
$json = [];
foreach ($this as $cookie) {
if ($cookie->getExpires() && !$cookie->getDiscard()) {
$json[] = $cookie->toArray();
}
}
if (false === file_put_contents($filename, json_encode($json), LOCK_EX)) {
// @codeCoverageIgnoreStart
throw new \RuntimeException("Unable to save file {$filename}");
// @codeCoverageIgnoreEnd
}
}
/**
* Load cookies from a JSON formatted file.
*