| Conditions | 3 |
| Paths | 2 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 1 | public static function modify(RequestInterface $request, string $name, callable $modify) : RequestInterface |
|
| 34 | { |
||
| 35 | 1 | if (! is_callable($modify)) { |
|
| 36 | 1 | throw new InvalidArgumentException('$modify must be callable.'); |
|
| 37 | 1 | } |
|
| 38 | 1 | ||
| 39 | $cookies = Cookies::fromRequest($request); |
||
| 40 | $cookie = $modify($cookies->has($name) |
||
| 41 | ? $cookies->get($name) |
||
| 42 | : Cookie::create($name)); |
||
| 43 | |||
| 44 | return $cookies |
||
| 45 | ->with($cookie) |
||
| 46 | ->renderIntoCookieHeader($request) |
||
| 47 | ; |
||
| 48 | 2 | } |
|
| 49 | |||
| 58 |