* and validates that the fields are provided correctly.
*/
class APIv3SchemaAdapter implements EventSubscriberInterface {
+
/**
* @return array
*/
public static function getSubscribedEvents() {
- return array(
- Events::PREPARE => array(
- array('onApiPrepare', Events::W_MIDDLE),
- array('onApiPrepare_validate', Events::W_LATE),
- ),
- );
+ return [
+ Events::PREPARE => [
+ ['onApiPrepare', Events::W_MIDDLE],
+ ['onApiPrepare_validate', Events::W_LATE],
+ ],
+ ];
}
/**
*/
public function onApiPrepare_validate(\Civi\API\Event\Event $event) {
$apiRequest = $event->getApiRequest();
+ if ($apiRequest['version'] > 3) {
+ return;
+ }
// Not sure why this is omitted for generic actions. It would make sense
// to omit 'getfields', but that's only one generic action.
* @return array
*/
public function getDefaults($fields) {
- $defaults = array();
+ $defaults = [];
foreach ($fields as $field => $values) {
if (isset($values['api.default'])) {
* @return array
*/
public function getRequired($fields) {
- $required = array('version');
+ $required = ['version'];
foreach ($fields as $field => $values) {
if (!empty($values['api.required'])) {