class civicrm_api3 {
/**
+ * Class constructor.
+ *
* @param array $config API configuration.
*/
- function __construct($config = NULL) {
+ public function __construct($config = NULL) {
$this->local = TRUE;
$this->input = array();
$this->lastResult = array();
}
/**
+ * Convert to string.
+ *
* @return string
*/
public function __toString() {
}
/**
- * Perform action
+ * Perform action.
+ *
* @param $action
* @param $params
+ *
* @return bool
*/
public function __call($action, $params) {
}
/**
- * As of PHP 5.3.0
+ * As of PHP 5.3.0.
+ *
* @param $name
* @param $arguments
*/
}
/**
- * Call via rest
+ * Call via rest.
+ *
* @param $entity
* @param $action
* @param array $params
+ *
* @return \stdClass
*/
- function remoteCall($entity, $action, $params = array()) {
+ public function remoteCall($entity, $action, $params = array()) {
$fields = "key={$this->key}&api_key={$this->api_key}";
$query = $this->uri . "&entity=$entity&action=$action";
foreach ($params as $k => $v) {
$result = curl_exec($ch);
// CiviCRM expects to get back a CiviCRM error object.
if (curl_errno($ch)) {
- $res = new stdClass;
+ $res = new stdClass();
$res->is_error = 1;
$res->error_message = curl_error($ch);
$res->level = "cURL";
$result = file_get_contents($query . '&' . $fields);
}
if (!$res = json_decode($result)) {
- $res = new stdClass;
+ $res = new stdClass();
$res->is_error = 1;
$res->error_message = 'Unable to parse returned JSON';
$res->level = 'json_decode';
}
/**
+ * Call api function.
+ *
* @param $entity
* @param string $action
* @param array $params
*
* @return bool
*/
- function call($entity, $action = 'Get', $params = array()) {
+ public function call($entity, $action = 'Get', $params = array()) {
if (is_int($params)) {
$params = array('id' => $params);
}
/**
* Helper method for long running programs (eg bots).
*/
- function ping() {
+ public function ping() {
global $_DB_DATAOBJECT;
foreach ($_DB_DATAOBJECT['CONNECTIONS'] as & $c) {
if (!$c->connection->ping()) {
* Return the last error message.
* @return string
*/
- function errorMsg() {
+ public function errorMsg() {
return $this->lastResult->error_message;
}
/**
- * Initialize
+ * Initialize.
*/
- function init() {
+ public function init() {
CRM_Core_DAO::init($this->cfg->dsn);
}
/**
+ * Get attribute.
+ *
* @param $name
* @param null $value
+ *
* @return $this
*/
public function attr($name, $value = NULL) {
}
/**
+ * Is this an error.
+ *
* @return bool
*/
public function is_error() {
}
/**
+ * Check if var is set.
+ *
* @param string $name
+ *
* @return bool
*/
public function is_set($name) {
}
/**
- * @param $name
+ * Get object.
+ *
+ * @param string $name
+ *
* @return $this
*/
public function __get($name) {
public function result() {
return $this->lastResult;
}
+
}