Checkstyle fix - one pesky whitespace
[civicrm-core.git] / api / v3 / EntityTag.php
index 2914afefbe1887cb0e7c7cda39e3a9ef4a30ec07..c775318defaac7321176be0a3b80d3956e83b21f 100644 (file)
@@ -1,10 +1,9 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
- * File for the CiviCRM APIv3 entity tag functions
+ * This api exposes CiviCRM EntityTag records.
  *
- * @package CiviCRM_APIv3
- * @subpackage API_EntityTag
+ * Use this api to add/remove tags from a contact/activity/etc.
+ * To create/update/delete the tags themselves, use the Tag api.
  *
- * @copyright CiviCRM LLC (c) 2004-2014
- * @version $Id: EntityTag.php 30879 2010-11-22 15:45:55Z shot $
- */
-
-/**
- * Include utility functions
+ * @package CiviCRM_APIv3
  */
 
 /**
- * {@getfields EntityTag_get}
- * @example EntityTagGet.php
+ * Get entity tags.
  *
  * @param array $params
  *
@@ -60,16 +53,17 @@ function civicrm_api3_entity_tag_get($params) {
     foreach ($values as $v) {
       $result[$v] = array('tag_id' => $v);
     }
-    return civicrm_api3_create_success($result, $params);
+    return civicrm_api3_create_success($result, $params, 'EntityTag');
   }
 }
 
 /**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
  *
- * The metadata is used for setting defaults, documentation & validation
  * @param array $params
- *   Array or parameters determined by getfields.
+ *   Array of parameters determined by getfields.
  */
 function _civicrm_api3_entity_tag_get_spec(&$params) {
   $params['entity_id']['api.aliases'] = array('contact_id');
@@ -77,20 +71,18 @@ function _civicrm_api3_entity_tag_get_spec(&$params) {
 }
 
 /**
+ * Create an entity tag.
  *
  * @param array $params
  *
  * @return array
- * {@getfields EntityTag_create}
- * @example EntityTagCreate.php
  */
 function civicrm_api3_entity_tag_create($params) {
   return _civicrm_api3_entity_tag_common($params, 'add');
 }
 
 /**
- * {@getfields EntityTag_delete}
- * @example EntityTagGet.php
+ * Mark entity tag as removed.
  *
  * @param array $params
  *
@@ -102,7 +94,9 @@ function civicrm_api3_entity_tag_delete($params) {
 }
 
 /**
- * modify metadata
+ * Modify metadata.
+ *
+ * @param array $params
  */
 function _civicrm_api3_entity_tag_delete_spec(&$params) {
   // set as not required as tag_id also acceptable & no either/or std yet
@@ -110,17 +104,16 @@ function _civicrm_api3_entity_tag_delete_spec(&$params) {
 }
 
 /**
+ * Helper function for formatting tags (part of api v2 legacy).
  *
- * @param <type> $params
+ * @param array $params
  * @param string $op
  *
  * @return array
-   *   <type>
  */
 function _civicrm_api3_entity_tag_common($params, $op = 'add') {
 
   $entityIDs   = array();
-  $tagsIDs     = array();
   $entityTable = 'civicrm_contact';
   if (is_array($params)) {
     foreach ($params as $n => $v) {