INFRA-132 - Comment grammar cleanup
[civicrm-core.git] / CRM / Core / BAO / Note.php
index 2e27bdacc2598f13115041ecc3f43a4961572e7a..84f8aa61b60e71fe6edf8979dc9dc10d92f2cf51 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
 class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
 
   /**
-   * const the max number of notes we display at any given time
+   * Const the max number of notes we display at any given time
    * @var int
    */
-  CONST MAX_NOTES = 3;
+  const MAX_NOTES = 3;
 
   /**
-   * given a note id, retrieve the note text
+   * Given a note id, retrieve the note text
    *
-   * @param int  $id   id of the note to retrieve
+   * @param int $id
+   *   Id of the note to retrieve.
    *
-   * @return string   the note text or null if note not found
+   * @return string   the note text or NULL if note not found
    *
-   * @access public
    * @static
    */
-  static function getNoteText($id) {
+  public static function getNoteText($id) {
     return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $id, 'note');
   }
 
   /**
-   * given a note id, retrieve the note subject
+   * Given a note id, retrieve the note subject
    *
-   * @param int  $id   id of the note to retrieve
+   * @param int $id
+   *   Id of the note to retrieve.
    *
-   * @return string   the note subject or null if note not found
+   * @return string   the note subject or NULL if note not found
    *
-   * @access public
    * @static
    */
-  static function getNoteSubject($id) {
+  public static function getNoteSubject($id) {
     return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $id, 'subject');
   }
 
   /**
-   * given a note id, decide if the note should be displayed based on privacy setting
+   * Given a note id, decide if the note should be displayed based on privacy setting
    *
-   * @param object  $note Either the id of the note to retrieve, or the CRM_Core_DAO_Note object itself
+   * @param object $note
+   *   Either the id of the note to retrieve, or the CRM_Core_DAO_Note object itself.
    *
    * @return boolean TRUE if the note should be displayed, otherwise FALSE
    *
-   * @access public
    * @static
    */
-  static function getNotePrivacyHidden($note) {
+  public static function getNotePrivacyHidden($note) {
     if (CRM_Core_Permission::check('view all notes')) {
       return FALSE;
     }
@@ -125,20 +125,21 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
   }
 
   /**
-   * takes an associative array and creates a note object
+   * Takes an associative array and creates a note object
    *
    * the function extract all the params it needs to initialize the create a
    * note object. the params array could contain additional unused name/value
    * pairs
    *
-   * @param array $params  (reference) an assoc array of name/value pairs
-   * @param array $ids (deprecated) associated array with note id - preferably set $params['id']
+   * @param array $params
+   *   (reference) an assoc array of name/value pairs.
+   * @param array $ids
+   *   (deprecated) associated array with note id - preferably set $params['id'].
    *
    * @return object $note CRM_Core_BAO_Note object
-   * @access public
    * @static
    */
-  static function &add(&$params, $ids = array()) {
+  public static function &add(&$params, $ids = array()) {
     $dataExists = self::dataExists($params);
     if (!$dataExists) {
       return CRM_Core_DAO::$_nullObject;
@@ -219,13 +220,13 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
   /**
    * Check if there is data to create the object
    *
-   * @param array  $params         (reference ) an assoc array of name/value pairs
+   * @param array $params
+   *   (reference ) an assoc array of name/value pairs.
    *
    * @return boolean
-   * @access public
    * @static
    */
-  static function dataExists(&$params) {
+  public static function dataExists(&$params) {
     // return if no data present
     if (!strlen($params['note'])) {
       return FALSE;
@@ -237,16 +238,17 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
    * Given the list of params in the params array, fetch the object
    * and store the values in the values array
    *
-   * @param array $params input parameters to find object
-   * @param array $values output values of the object
-   * @param int $numNotes the maximum number of notes to return (0 if all)
+   * @param array $params
+   *   Input parameters to find object.
+   * @param array $values
+   *   Output values of the object.
+   * @param int $numNotes
+   *   The maximum number of notes to return (0 if all).
    *
-   * @internal param array $ids the array that holds all the db ids
    * @return object $notes  Object of CRM_Core_BAO_Note
-   * @access public
    * @static
    */
-  static function &getValues(&$params, &$values, $numNotes = self::MAX_NOTES) {
+  public static function &getValues(&$params, &$values, $numNotes = self::MAX_NOTES) {
     if (empty($params)) {
       return NULL;
     }
@@ -280,15 +282,18 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
   }
 
   /**
-   * Function to delete the notes
+   * Delete the notes
    *
-   * @param int $id note id
-   * @param boolean $showStatus do we need to set status or not
+   * @param int $id
+   *   Note id.
+   * @param bool $showStatus
+   *   Do we need to set status or not.
    *
-   * @return mixed|null $return no of deleted notes on success, false otherwise@access public
+   * @return mixed|NULL $return no of deleted notes on success, FALSE otherwise
+   * @access public
    * @static
    */
-  static function del($id, $showStatus = TRUE) {
+  public static function del($id, $showStatus = TRUE) {
     $return   = NULL;
     $recent   = array($id);
     $note     = new CRM_Core_DAO_Note();
@@ -329,13 +334,13 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
   }
 
   /**
-   * delete all records for this contact id
+   * Delete all records for this contact id
    *
-   * @param int  $id ID of the contact for which note needs to be deleted.
+   * @param int $id
+   *   ID of the contact for which note needs to be deleted.
    *
    * @return void
    *
-   * @access public
    * @static
    */
   public static function deleteContact($id) {
@@ -352,15 +357,15 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
   }
 
   /**
-   * retrieve all records for this entity-id
+   * Retrieve all records for this entity-id
    *
-   * @param int $id ID of the relationship for which records needs to be retrieved.
+   * @param int $id
+   *   ID of the relationship for which records needs to be retrieved.
    *
    * @param string $entityTable
    *
    * @return array $viewNote array of note properties
    *
-   * @access public
    * @static
    */
   public static function &getNote($id, $entityTable = 'civicrm_relationship') {
@@ -386,18 +391,15 @@ ORDER BY  modified_date desc";
   }
 
   /**
-   * Function to get log record count for a Contact
-   *
-   * @param $contactID
+   * Get log record count for a Contact
    *
-   * @internal param int $contactId Contact ID
+   * @param int $contactID
    *
    * @return int $count count of log records
    *
-   * @access public
    * @static
    */
-  static function getContactNoteCount($contactID) {
+  public static function getContactNoteCount($contactID) {
     $note               = new CRM_Core_DAO_Note();
     $note->entity_id    = $contactID;
     $note->entity_table = 'civicrm_contact';
@@ -412,16 +414,18 @@ ORDER BY  modified_date desc";
   }
 
   /**
-   * Function to get all descendent notes of the note with given ID
+   * Get all descendent notes of the note with given ID
    *
-   * @param int $parentId ID of the note to start from
-   * @param int $maxDepth Maximum number of levels to descend into the tree; if not given, will include all descendents.
-   * @param bool $snippet If TRUE, returned values will be pre-formatted for display in a table of notes.
+   * @param int $parentId
+   *   ID of the note to start from.
+   * @param int $maxDepth
+   *   Maximum number of levels to descend into the tree; if not given, will include all descendents.
+   * @param bool $snippet
+   *   If TRUE, returned values will be pre-formatted for display in a table of notes.
    *
    * @return array Nested associative array beginning with direct children of given note.
    *
    * @static
-   * @access public
    */
   public static function getNoteTree($parentId, $maxDepth = 0, $snippet = FALSE) {
     return self::buildNoteTree($parentId, $maxDepth, $snippet);
@@ -430,12 +434,12 @@ ORDER BY  modified_date desc";
   /**
    * Get total count of direct children visible to the current user
    *
-   * @param int $id Note ID
+   * @param int $id
+   *   Note ID.
    *
    * @return int $count Number of notes having the give note as parent
    *
    * @static
-   * @access public
    */
   public static function getChildCount($id) {
     $note               = new CRM_Core_DAO_Note();
@@ -454,18 +458,23 @@ ORDER BY  modified_date desc";
   /**
    * Recursive function to get all descendent notes of the note with given ID
    *
-   * @param int $parentId ID of the note to start from
-   * @param int $maxDepth Maximum number of levels to descend into the tree; if not given, will include all descendents.
-   * @param bool $snippet If TRUE, returned values will be pre-formatted for display in a table of notes.
-   * @param array $tree (Reference) Variable to store all found descendents
-   * @param int $depth Depth of current iteration within the descendent tree (used for comparison against maxDepth)
+   * @param int $parentId
+   *   ID of the note to start from.
+   * @param int $maxDepth
+   *   Maximum number of levels to descend into the tree; if not given, will include all descendents.
+   * @param bool $snippet
+   *   If TRUE, returned values will be pre-formatted for display in a table of notes.
+   * @param array $tree
+   *   (Reference) Variable to store all found descendents.
+   * @param int $depth
+   *   Depth of current iteration within the descendent tree (used for comparison against maxDepth).
    *
    * @return array Nested associative array beginning with direct children of given note.
    * @static
    */
   private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = array(), $depth = 0) {
     if ($maxDepth && $depth > $maxDepth) {
-      return false;
+      return FALSE;
     }
 
     // get direct children of given parentId note
@@ -517,15 +526,16 @@ ORDER BY  modified_date desc";
   }
 
   /**
-   * given a note id, get a list of the ids of all notes that are descendents of that note
+   * Given a note id, get a list of the ids of all notes that are descendents of that note
    *
-   * @param int $parentId Id of the given note
-   * @param array $ids (reference) one-dimensional array to store found descendent ids
+   * @param int $parentId
+   *   Id of the given note.
+   * @param array $ids
+   *   (reference) one-dimensional array to store found descendent ids.
    *
    * @return array $ids One-dimensional array containing ids of all desendent notes
    */
-  public static function getDescendentIds($parentId, &$ids = array(
-    )) {
+  public static function getDescendentIds($parentId, &$ids = array()) {
     // get direct children of given parentId note
     $note               = new CRM_Core_DAO_Note();
     $note->entity_table = 'civicrm_note';
@@ -540,16 +550,15 @@ ORDER BY  modified_date desc";
   }
 
   /**
-   * function to delete all note related to contact when contact is deleted
+   * Delete all note related to contact when contact is deleted
    *
-   * @param int $contactID contact id whose notes to be deleted
-   *
-   * @internal param array $deleteNoteID to store all deleted note ids
+   * @param int $contactID
+   *   Contact id whose notes to be deleted.
    *
    * @return void
    * @static
    */
-  static function cleanContactNotes($contactID) {
+  public static function cleanContactNotes($contactID) {
     $params = array(1 => array($contactID, 'Integer'));
 
     // delete all notes related to contribution
@@ -575,4 +584,3 @@ WHERE participant.contact_id = %1 AND  note.entity_table = 'civicrm_participant'
     }
   }
 }
-