protected function Kitchen::shipItGood in Bakery Single Sign-On System 8.2
Helper method to ship specific cookie to the site.
Parameters
string $uri: The uri to recieve the cookie.
string $cookie_name: The name of the cookie.
string $data: The encrypted cookie data.
Return value
false|\Psr\Http\Message\ResponseInterface
1 call to Kitchen::shipItGood()
- Kitchen::ship in src/
Kitchen.php - Ship a cookie to child sites.
File
- src/
Kitchen.php, line 257
Class
Namespace
Drupal\bakeryCode
protected function shipItGood(string $uri, string $cookie_name, string $data) {
// @phpstan-ignore-next-line
$client = \Drupal::httpClient();
try {
return $client
->post($uri, [
'form_params' => [
$cookie_name => $data,
],
]);
} catch (BadResponseException $exception) {
$this
->getLogger('bakery')
->error('Failed to fetch file due to HTTP error "%error"', [
'%error' => $exception
->getMessage(),
]);
return FALSE;
} catch (RequestException $exception) {
$response = $exception
->getResponse();
$this
->getLogger('bakery')
->error('Failed to fetch file due to error "%error"', [
'%error' => $exception
->getMessage(),
]);
return FALSE;
}
}