Skip to content

Commit

Permalink
Add docblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwire committed Jan 10, 2023
1 parent 2624070 commit 26f5d75
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions CRM/Civiquickbooks/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ public function push($params) {
$abort_loop = TRUE;
throw new CiviCRM_API3_Exception('Authentication failure doing QBO contact push, aborting', 9000 + $error_code);
break;

default:
$account_contact['error_data'] = json_encode(['failures' => ++$failure_count, 'error' => $error_message]);
throw new Exception('"' . implode("\n", $error_message) . '"');
Expand Down Expand Up @@ -328,6 +329,12 @@ public function push($params) {
}
}

/**
* @param array $contact
*
* @return mixed|string
* @throws \CRM_Core_Exception
*/
public static function getBillingEmail($contact) {
if (is_array($contact)) {
$contact = $contact['id'];
Expand Down Expand Up @@ -361,6 +368,12 @@ public static function getBillingEmail($contact) {
return '';
}

/**
* @param array $contact
*
* @return array
* @throws \CRM_Core_Exception
*/
public static function getBillingAddr($contact) {
if (is_array($contact)) {
$contact = $contact['id'];
Expand Down Expand Up @@ -415,6 +428,12 @@ public static function getBillingAddr($contact) {
return [];
}

/**
* @param array $contact
*
* @return mixed|string
* @throws \CRM_Core_Exception
*/
public static function getBillingPhone($contact) {
if (is_array($contact)) {
$contact = $contact['id'];
Expand Down Expand Up @@ -451,7 +470,14 @@ public static function getBillingPhone($contact) {
return '';
}


/**
* @param array $contact
* @param string $accountsID
* @param array|NULL $customer_data
*
* @return mixed|null
* @throws \Exception
*/
protected function mapToCustomer($contact, $accountsID, $customer_data) {
$customer = [
"BillAddr" => self::getBillingAddr($contact),
Expand Down Expand Up @@ -494,6 +520,11 @@ protected function mapToCustomer($contact, $accountsID, $customer_data) {

/**
* Get all the customers from Quickbooks by providing a modification date.
*
* @param string $start_date_string
*
* @return array
* @throws \CRM_Civiquickbooks_Contact_Exception
*/
protected function getQBOContacts($start_date_string) {
$date = date('c', strtotime($start_date_string));
Expand Down Expand Up @@ -534,9 +565,9 @@ protected function getQBOContacts($start_date_string) {
* function reflects the same by accepting either a FullyQualifiedName or
* FamilyName + GivenName pair
*
* @param $name Family Name for Individuals or Company /
* @param string $name Family Name for Individuals or Company /
* Fully Qualified Name for Organisations
* @param $givenName Given Name for Individuals if present; Contact is assumed
* @param string $givenName Given Name for Individuals if present; Contact is assumed
* to be an Organisation otherwise.
*/
protected function getQBOContactByName($name, $givenName = NULL) {
Expand Down Expand Up @@ -566,7 +597,6 @@ protected function getQBOContactByName($name, $givenName = NULL) {
}
}


}

/**
Expand Down

0 comments on commit 26f5d75

Please sign in to comment.