for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Thruster\Component\Http\Parser;
use Psr\Http\Message\ServerRequestInterface;
/**
* Class CookieParamParser
*
* @package Thruster\Component\Http\Parser
* @author Aurimas Niekis <[email protected]>
*/
class CookieParamParser implements ParserInterface
{
* @inheritDoc
public function parse(ServerRequestInterface $request) : ServerRequestInterface
$headerValues = $request->getHeader('Cookie');
$cookies = [];
foreach ($headerValues as $headerValue) {
$parts = explode(';', str_replace('; ', ';', $headerValue));
foreach ($parts as $part) {
list($key, $value) = explode('=', $part);
$cookies[$key] = $value;
}
return $request->withCookieParams($cookies);