}
}
-/**
- * Get contact if for a form object. Prioritise
- * - cid in URL if 0 (on behalf on someoneelse)
- * (@todo consider setting a variable if onbehalf for clarity of downstream 'if's
- * - logged in user id if it matches the one in the cid in the URL
- * - contact id validated from a checksum from a checksum
- * - cid from the url if the caller has ACL permission to view
- * - fallback is logged in user (or ? NULL if no logged in user) (@todo wouldn't 0 be more intuitive?)
- *
- * @return Ambigous <mixed, NULL, value, unknown, array, number>|unknown
- */
+ /**
+ * Get contact if for a form object. Prioritise
+ * - cid in URL if 0 (on behalf on someoneelse)
+ * (@todo consider setting a variable if onbehalf for clarity of downstream 'if's
+ * - logged in user id if it matches the one in the cid in the URL
+ * - contact id validated from a checksum from a checksum
+ * - cid from the url if the caller has ACL permission to view
+ * - fallback is logged in user (or ? NULL if no logged in user) (@todo wouldn't 0 be more intuitive?)
+ *
+ * @return mixed NULL|integer
+ */
function getContactID() {
$tempID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if(isset($this->_params) && isset($this->_params['select_contact_id'])) {
const NOT_IMPLEMENTED = 'not-found';
private $extraParams = array();
+
+ /**
+ * @param string $message
+ * @param int $error_code
+ * @param array $extraParams
+ * @param Exception $previous
+ */
public function __construct($message, $error_code = 0, $extraParams = array(),Exception $previous = null) {
if (is_numeric ($error_code)) // using int for error code "old way")
$code = $error_code;
}
// custom string representation of object
+ /**
+ * @return string
+ */
public function __toString() {
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
+ /**
+ * @return array
+ */
public function getExtraParams() {
return $this->extraParams;
}
+ /**
+ * @return array
+ */
public function getErrorCodes(){
return array(
2000 => '$params was not an array',
class CiviCRM_API3_Exception extends Exception
{
private $extraParams = array();
+
+ /**
+ * @param string $message
+ * @param int $error_code
+ * @param array $extraParams
+ * @param Exception $previous
+ */
public function __construct($message, $error_code, $extraParams = array(),Exception $previous = null) {
parent::__construct(ts($message));
$this->extraParams = $extraParams + array('error_code' => $error_code);
}
// custom string representation of object
+ /**
+ * @return string
+ */
public function __toString() {
return __CLASS__ . ": [{$this->extraParams['error_code']}: {$this->message}\n";
}
public function getErrorCode() {
return $this->extraParams['error_code'];
}
+
+ /**
+ * @return array
+ */
public function getExtraParams() {
return $this->extraParams;
}
<?php
+/**
+ * Interface API_Wrapper
+ */
interface API_Wrapper {
/**
return FALSE;
}
+/**
+ * @param $entity
+ * @param null $version
+ *
+ * @return string
+ */
function _civicrm_api_get_camel_name($entity, $version = NULL) {
$fragments = explode('_', $entity);
foreach ($fragments as & $fragment) {
return $res;
}
+ /**
+ * @param $entity
+ * @param string $action
+ * @param array $params
+ *
+ * @return bool
+ */
function call($entity, $action = 'Get', $params = array()) {
if (is_int($params)) {
$params = array('id' => $params);
return civicrm_api3_create_error('Unknown civicrm constant or method not callable');
}
+/**
+ * @param $params
+ */
function _civicrm_api3_constant_get_spec(&$params) {
$params = (array
return civicrm_api3_create_success($contacts, $params, 'contact');
}
+/**
+ * @param $params
+ *
+ * @return int
+ */
function civicrm_api3_contact_getcount($params) {
$options = array();
_civicrm_api3_contact_get_supportanomalies($params, $options);
}
+/**
+ * @param $params
+ * @param bool $dupeCheck
+ * @param bool $dupeErrorArray
+ * @param bool $obsoletevalue
+ * @param null $dedupeRuleGroupID
+ *
+ * @return null
+ * @throws API_Exception
+ * @throws CiviCRM_API3_Exception
+ */
function _civicrm_api3_contact_check_params( &$params, $dupeCheck = true, $dupeErrorArray = false, $obsoletevalue = true, $dedupeRuleGroupID = null )
{
}
}
+/**
+ * @param $params
+ */
function _civicrm_api3_contact_proximity_spec(&$params) {
$params['latitude']['api.required'] = 1;
$params['longitude']['api.required'] = 1;
$params['unit']['api.default'] = 'meter';
}
+/**
+ * @param $params
+ *
+ * @return array
+ * @throws Exception
+ */
function civicrm_api3_contact_proximity($params) {
$latitude = CRM_Utils_Array::value('latitude', $params);
$longitude = CRM_Utils_Array::value('longitude', $params);
}
}
+/**
+ * @param $params
+ */
function _civicrm_api3_contribution_completetransaction(&$params) {
$params['id'] = array(
'title' => 'Contribution ID',
unset($params['version']);
}
+/**
+ * @param $params
+ *
+ * @return array|null
+ */
function _civicrm_api3_dashboard_contact_check_params(&$params) {
$dashboard_id = CRM_Utils_Array::value('dashboard_id', $params);
if ($dashboard_id) {
* @param int $event_id Id of the event to be updated
*
*/
+/**
+ * @param $event
+ * @param $event_id
+ */
function _civicrm_api3_event_getisfull(&$event, $event_id) {
$eventFullResult = CRM_Event_BAO_Participant::eventFull($event_id, 1);
if (!empty($eventFullResult) && is_int($eventFullResult)) {
+--------------------------------------------------------------------+
*/
+/**
+ * @param $apiRequest
+ *
+ * @return array
+ * @throws API_Exception
+ */
function civicrm_api3_generic_getActions($apiRequest) {
civicrm_api3_verify_mandatory($apiRequest, NULL, array('entity'));
$mfp = \Civi\Core\Container::singleton()->get('magic_function_provider');
return civicrm_api3_create_error("API (Location, Create) does not exist, use the Address/Phone/Email/Website API instead", array('obsoleted' => TRUE));
}
+/**
+ * @param $params
+ *
+ * @return array
+ */
function civicrm_api3_location_get($params) {
return civicrm_api3_create_error("API (Location, Get) does not exist, use the Address/Phone/Email/Website API instead", array('obsoleted' => TRUE));
}
+/**
+ * @param $params
+ *
+ * @return array
+ */
function civicrm_api3_location_delete($params) {
return civicrm_api3_create_error("API (Location, Delete) does not exist, use the Address/Phone/Email/Website API instead", array('obsoleted' => TRUE));
}
);
}
+/**
+ * @param $type
+ * @param $contactID
+ * @param $offset
+ * @param $limit
+ * @param $selectFields
+ * @param $fromClause
+ * @param $whereClause
+ * @param $sort
+ * @param $getCount
+ *
+ * @return array
+ */
function _civicrm_api3_mailing_contact_query(
$type,
$contactID,
return $results;
}
+/**
+ * @param $contactID
+ * @param $offset
+ * @param $limit
+ * @param $sort
+ * @param $getCount
+ *
+ * @return array
+ */
function _civicrm_api3_mailing_contact_get_delivered(
$contactID,
$offset,
);
}
+/**
+ * @param $contactID
+ * @param $offset
+ * @param $limit
+ * @param $sort
+ * @param $getCount
+ *
+ * @return array
+ */
function _civicrm_api3_mailing_contact_get_bounced(
$contactID,
$offset,
return civicrm_api('mailing_event_subscribe', 'create', $params);
}
+/**
+ * @param $params
+ *
+ * @return array
+ */
function civicrm_api3_mailing_group_getfields($params) {
$dao = _civicrm_api3_get_DAO('Subscribe');
$d = new $dao();
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
+/**
+ * @param $params
+ */
function _civicrm_api3_message_template_get_spec(&$params) {
}
<?php
+/**
+ * @param $params
+ *
+ * @return array
+ */
function civicrm_api3_option_group_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
}
}
+/**
+ * @param $params
+ */
function _civicrm_api3_pledge_delete_spec(&$params) {
// set as not required as pledge_id also acceptable & no either/or std yet
$params['id']['api.aliases'] = array('pledge_id');
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
+/**
+ * @param $pledgeId
+ * @param $paymentStatusId
+ * @param $paymentIds
+ *
+ * @return mixed
+ */
function updatePledgePayments($pledgeId, $paymentStatusId, $paymentIds) {
$result = updatePledgePayments($pledgeId, $paymentStatusId, $paymentIds = NULL);
}
}
+/**
+ * @param $params
+ */
function _civicrm_api3_profile_get_spec(&$params) {
$params['profile_id']['api.required'] = TRUE;
$params['contact_id']['description'] = 'If no contact is specified an array of defaults will be returned';
return $profileFields[$profileID];
}
+/**
+ * @param $a
+ * @param $b
+ *
+ * @return bool
+ */
function _civicrm_api3_order_by_weight($a, $b) {
return CRM_Utils_Array::value('weight', $b) < CRM_Utils_Array::value('weight', $a) ? TRUE : FALSE;
}
return civicrm_api3_create_success($rows, $params, 'report_template', 'getrows', CRM_Core_DAO::$_nullObject, $metadata);
}
+/**
+ * @param $params
+ *
+ * @return array
+ * @throws API_Exception
+ * @throws CiviCRM_API3_Exception
+ */
function _civicrm_api3_report_template_getrows($params) {
if(empty($params['report_id'])) {
$params['report_id'] = civicrm_api3('report_instance', 'getvalue', array('id' => $params['instance_id'], 'return' => 'report_id'));
return array($rows, $reportInstance, $metadata);
}
+/**
+ * @param $params
+ *
+ * @return array
+ */
function civicrm_api3_report_template_getstatistics($params) {
list($rows, $reportInstance, $metadata) = _civicrm_api3_report_template_getrows($params);
$stats = $reportInstance->statistics($rows);