Merge pull request #4923 from colemanw/invoice_id
[civicrm-core.git] / api / v3 / Generic.php
index 17556f86f30dc0ab0616f4ccfd5dfaf3a7e57cee..4de5a5db663b72c8df0ed491994f0d3f7e399fbb 100644 (file)
  *
  * @param array $apiRequest
  *   Api request as an array. Keys are.
- *  - entity: string
- *  - action: string
- *  - version: string
- *  - function: callback (mixed)
- *  - params: array, varies
- *  @return array API success object
+ *   - entity: string
+ *   - action: string
+ *   - version: string
+ *   - function: callback (mixed)
+ *   - params: array, varies
+ * @return array
+ *   API success object
  */
 function civicrm_api3_generic_getfields($apiRequest) {
   static $results = array();
@@ -55,6 +56,7 @@ function civicrm_api3_generic_getfields($apiRequest) {
     case 'getfields':
       $values = _civicrm_api_get_fields($entity, FALSE, $apiRequest['params']);
       return civicrm_api3_create_success($values, $apiRequest['params'], $entity, 'getfields');
+
     case 'create':
     case 'update':
     case 'replace':
@@ -71,7 +73,7 @@ function civicrm_api3_generic_getfields($apiRequest) {
           $metadata['id']['api.aliases'] = array($lcase_entity . '_id');
         }
       }
-      else{
+      else {
         // really the preference would be to set the unique name in the xml
         // question is which is a less risky fix this close to a release - setting in xml for the known failure
         // (note) or setting for all api where fields is returning 'id' & we want to accept 'note_id' @ the api layer
@@ -104,7 +106,8 @@ function civicrm_api3_generic_getfields($apiRequest) {
           'title' => 'Context',
         ),
       );
-        break;
+      break;
+
     default:
       // oddballs are on their own
       $metadata = array();
@@ -147,12 +150,13 @@ function civicrm_api3_generic_getfields($apiRequest) {
  *   Api request as an array. Keys are.
  *
  * @throws API_Exception
- * @return integer count of results
+ * @return int
+ *   count of results
  */
 function civicrm_api3_generic_getcount($apiRequest) {
   $apiRequest['params']['options']['is_count'] = TRUE;
   $result = civicrm_api($apiRequest['entity'], 'get', $apiRequest['params']);
-  if (is_numeric (CRM_Utils_Array::value('values', $result))) {
+  if (is_numeric(CRM_Utils_Array::value('values', $result))) {
     return (int) $result['values'];
   }
   if (!isset($result['count'])) {
@@ -167,7 +171,8 @@ function civicrm_api3_generic_getcount($apiRequest) {
  * @param array $apiRequest
  *   Api request as an array. Keys are.
  *
- * @return integer count of results
+ * @return int
+ *   count of results
  */
 function civicrm_api3_generic_getsingle($apiRequest) {
   // so the first entity is always result['values'][0]
@@ -191,7 +196,8 @@ function civicrm_api3_generic_getsingle($apiRequest) {
  * @param array $apiRequest
  *   Api request as an array. Keys are.
  *
- * @return integer count of results
+ * @return int
+ *   count of results
  */
 function civicrm_api3_generic_getvalue($apiRequest) {
   $apiRequest['params']['sequential'] = 1;
@@ -231,7 +237,8 @@ function _civicrm_api3_generic_getrefcount_spec(&$params) {
  *   Api request as an array.
  *
  * @throws API_Exception
- * @return array API result (int 0 or 1)
+ * @return array
+ *   API result (int 0 or 1)
  */
 function civicrm_api3_generic_getrefcount($apiRequest) {
   $entityToClassMap = CRM_Core_DAO_AllCoreTables::daoToClass();
@@ -257,7 +264,8 @@ function civicrm_api3_generic_getrefcount($apiRequest) {
  * @param array $apiRequest
  *   Api request as an array. Keys are.
  *
- * @return integer count of results
+ * @return int
+ *   count of results
  */
 function civicrm_api3_generic_replace($apiRequest) {
   return _civicrm_api3_generic_replace($apiRequest['entity'], $apiRequest['params']);
@@ -269,7 +277,8 @@ function civicrm_api3_generic_replace($apiRequest) {
  * @param array $apiRequest
  *   Api request as an array.
  *
- * @return array of results
+ * @return array
+ *   Array of results
  */
 function civicrm_api3_generic_getoptions($apiRequest) {
   // Resolve aliases
@@ -307,7 +316,7 @@ function civicrm_api3_generic_getoptions($apiRequest) {
  *
  * @param array $metadata
  *   The array of metadata that will form the result of the getfields function.
- * @param $apiRequest
+ * @param array $apiRequest
  * @param string $fieldname
  *   Field currently being processed.
  * @param array $fieldSpec