Commit | Line | Data |
---|---|---|
132ec342 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
41498ac5 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
132ec342 | 5 | | | |
41498ac5 TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
132ec342 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
132ec342 TO |
11 | |
12 | namespace Civi\API\Event; | |
13 | ||
6550386a EM |
14 | /** |
15 | * Class RespondEvent | |
16 | * @package Civi\API\Event | |
39b870b8 TO |
17 | * |
18 | * Apply post-execution filtering to the API request/response. | |
19 | * | |
20 | * Event name: 'civi.api.respond' | |
6550386a | 21 | */ |
132ec342 TO |
22 | class RespondEvent extends Event { |
23 | /** | |
24 | * @var mixed | |
25 | */ | |
26 | private $response; | |
27 | ||
6550386a | 28 | /** |
8882ff5c TO |
29 | * @param \Civi\API\Provider\ProviderInterface $apiProvider |
30 | * The API provider responsible for executing the request. | |
31 | * @param array $apiRequest | |
32 | * The full description of the API request. | |
33 | * @param mixed $response | |
34 | * The response to return to the client. | |
c98e9ee3 TO |
35 | * @param \Civi\API\Kernel $apiKernel |
36 | * The kernel which fired the event. | |
6550386a | 37 | */ |
c98e9ee3 | 38 | public function __construct($apiProvider, $apiRequest, $response, $apiKernel) { |
132ec342 | 39 | $this->response = $response; |
c98e9ee3 | 40 | parent::__construct($apiProvider, $apiRequest, $apiKernel); |
132ec342 TO |
41 | } |
42 | ||
43 | /** | |
44 | * @return mixed | |
45 | */ | |
46 | public function getResponse() { | |
47 | return $this->response; | |
48 | } | |
49 | ||
50 | /** | |
51 | * @param mixed $response | |
8882ff5c | 52 | * The response to return to the client. |
132ec342 TO |
53 | */ |
54 | public function setResponse($response) { | |
55 | $this->response = $response; | |
56 | } | |
96025800 | 57 | |
132ec342 | 58 | } |