Merge pull request #19390 from civicrm/php_version_bump
[civicrm-core.git] / Civi / API / Event / Event.php
CommitLineData
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
12namespace Civi\API\Event;
13
6550386a
EM
14/**
15 * Class Event
16 * @package Civi\API\Event
17 */
132ec342 18class Event extends \Symfony\Component\EventDispatcher\Event {
c98e9ee3
TO
19
20 /**
21 * @var \Civi\API\Kernel
22 */
23 protected $apiKernel;
24
132ec342 25 /**
787604ff 26 * @var \Civi\API\Provider\ProviderInterface
8882ff5c 27 * The API provider responsible for executing the request.
132ec342
TO
28 */
29 protected $apiProvider;
30
31 /**
32 * @var array
8882ff5c
TO
33 * The full description of the API request.
34 *
35 * @see \Civi\API\Request::create
132ec342
TO
36 */
37 protected $apiRequest;
38
6550386a 39 /**
8882ff5c
TO
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.
3bdf1f3a 44 * @param \Civi\API\Kernel $apiKernel
6550386a 45 */
c98e9ee3
TO
46 public function __construct($apiProvider, $apiRequest, $apiKernel) {
47 $this->apiKernel = $apiKernel;
132ec342
TO
48 $this->apiProvider = $apiProvider;
49 $this->apiRequest = $apiRequest;
50 }
51
c98e9ee3 52 /**
3bdf1f3a 53 * Get api kernel.
54 *
c98e9ee3
TO
55 * @return \Civi\API\Kernel
56 */
57 public function getApiKernel() {
58 return $this->apiKernel;
59 }
60
132ec342 61 /**
787604ff 62 * @return \Civi\API\Provider\ProviderInterface
132ec342
TO
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 }
96025800 74
9abe1c3b
TO
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
132ec342 88}