Merge pull request #15475 from mecachisenros/externUrl
[civicrm-core.git] / Civi / API / Event / Event.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 |
9 +--------------------------------------------------------------------+
10 */
11
12 namespace Civi\API\Event;
13
14 /**
15 * Class Event
16 * @package Civi\API\Event
17 */
18 class Event extends \Symfony\Component\EventDispatcher\Event {
19
20 /**
21 * @var \Civi\API\Kernel
22 */
23 protected $apiKernel;
24
25 /**
26 * @var \Civi\API\Provider\ProviderInterface
27 * The API provider responsible for executing the request.
28 */
29 protected $apiProvider;
30
31 /**
32 * @var array
33 * The full description of the API request.
34 *
35 * @see \Civi\API\Request::create
36 */
37 protected $apiRequest;
38
39 /**
40 * @param \Civi\API\Provider\ProviderInterface $apiProvider
41 * The API responsible for executing the request.
42 * @param array $apiRequest
43 * The full description of the API request.
44 * @param \Civi\API\Kernel $apiKernel
45 */
46 public function __construct($apiProvider, $apiRequest, $apiKernel) {
47 $this->apiKernel = $apiKernel;
48 $this->apiProvider = $apiProvider;
49 $this->apiRequest = $apiRequest;
50 }
51
52 /**
53 * Get api kernel.
54 *
55 * @return \Civi\API\Kernel
56 */
57 public function getApiKernel() {
58 return $this->apiKernel;
59 }
60
61 /**
62 * @return \Civi\API\Provider\ProviderInterface
63 */
64 public function getApiProvider() {
65 return $this->apiProvider;
66 }
67
68 /**
69 * @return array
70 */
71 public function getApiRequest() {
72 return $this->apiRequest;
73 }
74
75 /**
76 * Create a brief string identifying the entity/action. Useful for
77 * pithy matching/switching.
78 *
79 * Ex: if ($e->getApiRequestSig() === '3.contact.get') { ... }
80 *
81 * @return string
82 * Ex: '3.contact.get'
83 */
84 public function getApiRequestSig() {
85 return mb_strtolower($this->apiRequest['version'] . '.' . $this->apiRequest['entity'] . '.' . $this->apiRequest['action']);
86 }
87
88 }