INFRA-132 - Batch 14 (g)
[civicrm-core.git] / api / v3 / Event.php
index 9f29a83e9e65e093e3d17bc6b32c36415a8ec633..cc4f08fe10018bb7eae05323812c58b7a9c545bd 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  *
  */
 
-/**
- * Files required for this package
- */
-
 /**
  * Create a Event
  *
  * This API is used for creating a Event
  *
- * @param  array   $params   input parameters
- * Allowed @params array keys are:
+ * @param array $params
+ *   Input parameters.
+ *   Allowed @params array keys are:
  * {@getfields event_create}
  *
- * @return array API result Array.
- * @access public
+ * @return array
+ *   API result Array.
  */
 function civicrm_api3_event_create($params) {
   civicrm_api3_verify_one_mandatory($params, NULL, array('event_type_id', 'template_id'));
@@ -72,7 +68,8 @@ function civicrm_api3_event_create($params) {
  * Adjust Metadata for Create action
  *
  * The metadata is used for setting defaults, documentation & validation
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ *   Array or parameters determined by getfields.
  */
 function _civicrm_api3_event_create_spec(&$params) {
   $params['start_date']['api.required'] = 1;
@@ -87,9 +84,10 @@ function _civicrm_api3_event_create_spec(&$params) {
  * The main purpose of the API is to provide integrators a level of stability not provided by
  * the core code or schema - this means we have to provide support for api calls (where possible)
  * across schema changes.
+ * @param array $params
  */
-function _civicrm_api3_event_create_legacy_support_42(&$params){
-  if(!empty($params['payment_processor_id'])){
+function _civicrm_api3_event_create_legacy_support_42(&$params) {
+  if (!empty($params['payment_processor_id'])) {
     $params['payment_processor'] = CRM_Core_DAO::VALUE_SEPARATOR . $params['payment_processor_id'] . CRM_Core_DAO::VALUE_SEPARATOR;
   }
 }
@@ -97,13 +95,10 @@ function _civicrm_api3_event_create_legacy_support_42(&$params){
 /**
  * Get Event record.
  *
+ * @param array $params
  *
- * @param  array  $params     an associative array of name/value property values of civicrm_event
- * {@getfields event_get}
- *
- * @return  Array of all found event property values.
- * @access public
- *
+ * @return array
+ *   Array of all found event property values.
  */
 function civicrm_api3_event_get($params) {
 
@@ -147,7 +142,7 @@ function civicrm_api3_event_get($params) {
     }
     _civicrm_api3_event_get_legacy_support_42($event, $eventDAO->id);
     _civicrm_api3_custom_data_get($event[$eventDAO->id], 'Event', $eventDAO->id, NULL, $eventDAO->event_type_id);
-    if(!empty($options['return'])) {
+    if (!empty($options['return'])) {
       $event[$eventDAO->id]['price_set_id'] = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $eventDAO->id);
     }
   }
@@ -159,7 +154,8 @@ function civicrm_api3_event_get($params) {
  * Adjust Metadata for Get action
  *
  * The metadata is used for setting defaults, documentation & validation
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ *   Array or parameters determined by getfields.
  */
 function _civicrm_api3_event_get_spec(&$params) {
   $params['financial_type_id']['api.aliases'] = array('contribution_type_id');
@@ -170,11 +166,13 @@ function _civicrm_api3_event_get_spec(&$params) {
  * The main purpose of the API is to provide integrators a level of stability not provided by
  * the core code or schema - this means we have to provide support for api calls (where possible)
  * across schema changes.
+ * @param $event
+ * @param $event_id
  */
-function _civicrm_api3_event_get_legacy_support_42(&$event, $event_id){
-  if(!empty($event[$event_id]['payment_processor'])){
-    $processors = explode(CRM_Core_DAO::VALUE_SEPARATOR,$event[$event_id]['payment_processor']);
-    if(count($processors) == 3 ){
+function _civicrm_api3_event_get_legacy_support_42(&$event, $event_id) {
+  if (!empty($event[$event_id]['payment_processor'])) {
+    $processors = explode(CRM_Core_DAO::VALUE_SEPARATOR, $event[$event_id]['payment_processor']);
+    if (count($processors) == 3) {
       $event[$event_id]['payment_processor_id'] = $processors[1];
     }
   }
@@ -185,15 +183,10 @@ function _civicrm_api3_event_get_legacy_support_42(&$event, $event_id){
  *
  * This API is used for deleting a event
  *
- * @param  Array  $params    array containing event_id to be deleted
- *
- * @return boolean        true if success, error otherwise
- * @access public
- *   note API has legacy support for 'event_id'
- *  {@getfields event_delete}
+ * @param array $params
+ * @return array
  */
 function civicrm_api3_event_delete($params) {
-
   return CRM_Event_BAO_Event::del($params['id']) ? civicrm_api3_create_success() : civicrm_api3_create_error(ts('Error while deleting event'));
 }
 /*
@@ -202,8 +195,10 @@ function civicrm_api3_event_delete($params) {
  * add 'is_full' & 'available_seats' to the return array. (this might be better in the BAO)
  * Default BAO function returns a string if full rather than a Bool - which is more appropriate to a form
  *
- * @param array $event return array of the event
- * @param int $event_id Id of the event to be updated
+ * @param array $event
+ *   Return array of the event.
+ * @param int $event_id
+ *   Id of the event to be updated.
  *
  */
 /**
@@ -223,9 +218,10 @@ function _civicrm_api3_event_getisfull(&$event, $event_id) {
 
 
 /**
- * @see _civicrm_api3_generic_getlist_params.
+ * @see _civicrm_api3_generic_getlist_params
  *
- * @param $request array
+ * @param $request
+ *   Array.
  */
 function _civicrm_api3_event_getlist_params(&$request) {
   $fieldsToReturn = array('start_date', 'event_type_id', 'title', 'summary');
@@ -240,8 +236,10 @@ function _civicrm_api3_event_getlist_params(&$request) {
 /**
  * @see _civicrm_api3_generic_getlist_output
  *
- * @param $result array
- * @param $request array
+ * @param $result
+ *   Array.
+ * @param $request
+ *   Array.
  *
  * @return array
  */