diff options
| author | Eole <EoleDev@outlook.fr> | 2016-04-27 16:42:28 +0200 |
|---|---|---|
| committer | Eole <EoleDev@outlook.fr> | 2016-04-27 16:42:28 +0200 |
| commit | 49f416dc5061032e0514ea0cfeceaca37d13e432 (patch) | |
| tree | 1202ac2a6fa860b8929afdc886c94fc50bd0a1de /server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php | |
| parent | c7edd70b5e5b0f5159c78ce3d924d4e7f60db816 (diff) | |
| parent | c9202d9113210981ae47df40511645da2ee140df (diff) | |
Merge branch 'develop' into Eole_Graph
Conflicts:
client/index.html
client/js/controllers/home/home.js
client/partials/home/home.html
Diffstat (limited to 'server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php')
| -rw-r--r-- | server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php b/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php deleted file mode 100644 index e4e6248..0000000 --- a/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php -namespace GuzzleHttp\Cookie; - -/** - * Persists non-session cookies using a JSON formatted file - */ -class FileCookieJar extends CookieJar -{ - /** @var string filename */ - private $filename; - - /** @var bool Control whether to persist session cookies or not. */ - private $storeSessionCookies; - - /** - * Create a new FileCookieJar object - * - * @param string $cookieFile File to store the cookie data - * @param bool $storeSessionCookies Set to true to store session cookies - * in the cookie jar. - * - * @throws \RuntimeException if the file cannot be found or created - */ - public function __construct($cookieFile, $storeSessionCookies = false) - { - $this->filename = $cookieFile; - $this->storeSessionCookies = $storeSessionCookies; - - if (file_exists($cookieFile)) { - $this->load($cookieFile); - } - } - - /** - * Saves the file when shutting down - */ - public function __destruct() - { - $this->save($this->filename); - } - - /** - * 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) { - /** @var SetCookie $cookie */ - if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { - $json[] = $cookie->toArray(); - } - } - - if (false === file_put_contents($filename, json_encode($json))) { - throw new \RuntimeException("Unable to save file {$filename}"); - } - } - - /** - * Load cookies from a JSON formatted file. - * - * Old cookies are kept unless overwritten by newly loaded ones. - * - * @param string $filename Cookie file to load. - * @throws \RuntimeException if the file cannot be loaded. - */ - public function load($filename) - { - $json = file_get_contents($filename); - if (false === $json) { - throw new \RuntimeException("Unable to load file {$filename}"); - } - - $data = json_decode($json, true); - if (is_array($data)) { - foreach (json_decode($json, true) as $cookie) { - $this->setCookie(new SetCookie($cookie)); - } - } elseif (strlen($data)) { - throw new \RuntimeException("Invalid cookie file: {$filename}"); - } - } -} |
