<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.7 |
+ | CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
* @package Civi
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
class Kernel {
* @param array $apiProviders
* Array of ProviderInterface.
*/
- public function __construct($dispatcher, $apiProviders = array()) {
+ public function __construct($dispatcher, $apiProviders = []) {
$this->apiProviders = $apiProviders;
$this->dispatcher = $dispatcher;
}
if (!$resolveEvent->getApiProvider()) {
throw new \Civi\API\Exception\NotImplementedException("API (" . $apiRequest['entity'] . ", " . $apiRequest['action'] . ") does not exist (join the API team and implement it!)");
}
- return array($resolveEvent->getApiProvider(), $apiRequest);
+ return [$resolveEvent->getApiProvider(), $apiRequest];
}
/**
*/
public function getEntityNames($version) {
// Question: Would it better to eliminate $this->apiProviders and just use $this->dispatcher?
- $entityNames = array();
+ $entityNames = [];
foreach ($this->getApiProviders() as $provider) {
/** @var ProviderInterface $provider */
$entityNames = array_merge($entityNames, $provider->getEntityNames($version));
*/
public function getActionNames($version, $entity) {
// Question: Would it better to eliminate $this->apiProviders and just use $this->dispatcher?
- $actionNames = array();
+ $actionNames = [];
foreach ($this->getApiProviders() as $provider) {
/** @var ProviderInterface $provider */
$actionNames = array_merge($actionNames, $provider->getActionNames($version, $entity));
* API response.
*/
public function formatException($e, $apiRequest) {
- $data = array();
+ $data = [];
if (!empty($apiRequest['params']['debug'])) {
$data['trace'] = $e->getTraceAsString();
}
* API response.
*/
public function formatPearException($e, $apiRequest) {
- $data = array();
+ $data = [];
$error = $e->getCause();
if ($error instanceof \DB_Error) {
$data["error_code"] = \DB::errorMessage($error->getCode());