class Response in Payment 8.2
Provides a payment response.
Hierarchy
- class \Drupal\payment\Response\Response implements ResponseInterface
Expanded class hierarchy of Response
4 files declare their use of Response
- PaymentForm.php in modules/
payment_form/ src/ Plugin/ Payment/ Type/ PaymentForm.php - PaymentReference.php in modules/
payment_reference/ src/ Plugin/ Payment/ Type/ PaymentReference.php - PaymentTestResponse.php in modules/
payment_test/ src/ Plugin/ Payment/ Method/ PaymentTestResponse.php - ResponseTest.php in tests/
src/ Unit/ Response/ ResponseTest.php
File
- src/
Response/ Response.php, line 12
Namespace
Drupal\payment\ResponseView source
class Response implements ResponseInterface {
/**
* The redirect URL.
*
* @var \Drupal\Core\Url
*/
protected $url;
/**
* The response.
*
* @var \Symfony\Component\HttpFoundation\Response|null
*/
protected $response;
/**
* Creates a new instance.
*
* @param \Drupal\Core\Url $url
* @param \Symfony\Component\HttpFoundation\Response|null $response
*/
public function __construct(Url $url, SymfonyResponse $response = NULL) {
$this->response = $response;
$this->url = $url;
}
/**
* {@inheritdoc}
*/
public function getRedirectUrl() {
return $this->url;
}
/**
* {@inheritdoc}
*/
public function getResponse() {
if (!$this->response) {
// Ensure that bubbleable metadata is collected and added to the response
// object.
$url = $this->url
->toString(TRUE);
$this->response = new TrustedRedirectResponse($url
->getGeneratedUrl());
$this->response
->addCacheableDependency($url);
}
return $this->response;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Response:: |
protected | property | The response. | |
Response:: |
protected | property | The redirect URL. | |
Response:: |
public | function |
Gets the URL the calling code may redirect to after payment execution. Overrides ResponseInterface:: |
|
Response:: |
public | function |
Gets the response the calling code must return after payment execution. Overrides ResponseInterface:: |
|
Response:: |
public | function | Creates a new instance. |