Skip to content

Commit 3daf93b

Browse files
authored
Merge pull request #6646 from sclubricants/RequestCLIgetCookie
Add CLIRequest::getCookie()
2 parents 046c540 + 7faeeaa commit 3daf93b

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

system/HTTP/CLIRequest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,20 @@ public function getGetPost($index = null, $filter = null, $flags = null)
272272
return $this->returnNullOrEmptyArray($index);
273273
}
274274

275+
/**
276+
* This is a place holder for calls from cookie_helper get_cookie().
277+
*
278+
* @param array|string|null $index Index for item to be fetched from $_COOKIE
279+
* @param int|null $filter A filter name to be applied
280+
* @param mixed $flags
281+
*
282+
* @return array|null
283+
*/
284+
public function getCookie($index = null, $filter = null, $flags = null)
285+
{
286+
return $this->returnNullOrEmptyArray($index);
287+
}
288+
275289
/**
276290
* @param array|string|null $index
277291
*

tests/system/HTTP/CLIRequestTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,4 +616,11 @@ public function testGetLocale()
616616
{
617617
$this->assertSame('en', $this->request->getLocale());
618618
}
619+
620+
public function testGetCookie()
621+
{
622+
$this->assertNull($this->request->getCookie('TESTY'));
623+
624+
$this->assertSame($this->request->getCookie(), []);
625+
}
619626
}

0 commit comments

Comments
 (0)