INFRA-132 - Fix @static docblock tag
[civicrm-core.git] / api / v3 / Extension.php
index 5fdefe2a5ea2b100917e573ce5c1b33923e0e712..499bb054f5321505f5a54340f233c5a0f09df9ca 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -42,13 +42,15 @@ define('API_V3_EXTENSION_DELIMITER', ',');
 /**
  * Install an extension
  *
- * @param  array       $params input parameters
+ * @param array $params
+ *   Input parameters.
  *                          - key: string, eg "com.example.myextension"
  *                          - keys: mixed; array of string, eg array("com.example.myextension1", "com.example.myextension2") or string with comma-delimited list
  *                            using 'keys' should be more performant than making multiple API calls with 'key'
  *
- * @return array API result
- * @static void
+ * @return array
+ *   API result
+ * @static
  * @access public
  * @example ExtensionInstall.php
  *
@@ -61,7 +63,8 @@ function civicrm_api3_extension_install($params) {
 
   try {
     CRM_Extension_System::singleton()->getManager()->install($keys);
-  } catch (CRM_Extension_Exception $e) {
+  }
+  catch (CRM_Extension_Exception $e) {
     return civicrm_api3_create_error($e->getMessage());
   }
 
@@ -71,8 +74,9 @@ function civicrm_api3_extension_install($params) {
 /**
  * Upgrade an extension - runs upgrade_N hooks and system.flush
  *
- * @return array API result
- * @static void
+ * @return array
+ *   API result
+ * @static
  * @access public
  *
  */
@@ -87,13 +91,15 @@ function civicrm_api3_extension_upgrade() {
 
   try {
     $result = $runner->runAll();
-  } catch (CRM_Extension_Exception $e) {
+  }
+  catch (CRM_Extension_Exception $e) {
     return civicrm_api3_create_error($e->getMessage());
   }
 
   if ($result === TRUE) {
     return civicrm_api3_create_success();
-  } else {
+  }
+  else {
     return $result;
   }
 }
@@ -101,13 +107,15 @@ function civicrm_api3_extension_upgrade() {
 /**
  * Enable an extension
  *
- * @param  array       $params input parameters
+ * @param array $params
+ *   Input parameters.
  *                          - key: string, eg "com.example.myextension"
  *                          - keys: mixed; array of string, eg array("com.example.myextension1", "com.example.myextension2") or string with comma-delimited list
  *                            using 'keys' should be more performant than making multiple API calls with 'key'
  *
- * @return array API result
- * @static void
+ * @return array
+ *   API result
+ * @static
  * @access public
  * @example ExtensionEnable.php
  *
@@ -125,13 +133,15 @@ function civicrm_api3_extension_enable($params) {
 /**
  * Disable an extension
  *
- * @param  array       $params input parameters
+ * @param array $params
+ *   Input parameters.
  *                          - key: string, eg "com.example.myextension"
  *                          - keys: mixed; array of string, eg array("com.example.myextension1", "com.example.myextension2") or string with comma-delimited list
  *                            using 'keys' should be more performant than making multiple API calls with 'key'
  *
- * @return array API result
- * @static void
+ * @return array
+ *   API result
+ * @static
  * @access public
  * @example ExtensionDisable.php
  *
@@ -149,14 +159,16 @@ function civicrm_api3_extension_disable($params) {
 /**
  * Uninstall an extension
  *
- * @param  array       $params input parameters
+ * @param array $params
+ *   Input parameters.
  *                          - key: string, eg "com.example.myextension"
  *                          - keys: array of string, eg array("com.example.myextension1", "com.example.myextension2")
  *                            using 'keys' should be more performant than making multiple API calls with 'key'
  *                          - removeFiles: bool, whether to remove source tree; default: FALSE
  *
- * @return array API result
- * @static void
+ * @return array
+ *   API result
+ * @static
  * @access public
  * @example ExtensionUninstall.php
  *
@@ -175,13 +187,15 @@ function civicrm_api3_extension_uninstall($params) {
 /**
  * Download and install an extension
  *
- * @param  array $params input parameters
+ * @param array $params
+ *   Input parameters.
  *                          - key: string, eg "com.example.myextension"
  *                          - url: string eg "http://repo.com/myextension-1.0.zip"
  *
  * @throws API_Exception
- * @return array API result
- * @static void
+ * @return array
+ *   API result
+ * @static
  * @access public
  * @example ExtensionDownload.php
  */
@@ -226,12 +240,14 @@ function civicrm_api3_extension_download($params) {
 /**
  * Download and install an extension
  *
- * @param  array       $params input parameters
+ * @param array $params
+ *   Input parameters.
  *                          - local: bool, whether to rescan local filesystem (default: TRUE)
  *                          - remote: bool, whether to rescan remote repository (default: TRUE)
  *
- * @return array API result
- * @static void
+ * @return array
+ *   API result
+ * @static
  * @access public
  * @example ExtensionRefresh.php
  *
@@ -262,8 +278,9 @@ function civicrm_api3_extension_refresh($params) {
  *
  * @param array $params
  *
- * @return array API result
- * @static void
+ * @return array
+ *   API result
+ * @static
  * @access public
  * @example ExtensionGet.php
  */
@@ -275,8 +292,8 @@ function civicrm_api3_extension_get($params) {
     //try {
     //  $info = (array) $mapper->keyToInfo($key);
     //} catch (CRM_Extension_Exception $e) {
-      $info = array();
-      $info['key'] = $key;
+    $info = array();
+    $info['key'] = $key;
     //}
     $info['status'] = $status;
     $result[] = $info;
@@ -287,22 +304,28 @@ function civicrm_api3_extension_get($params) {
 /**
  * Determine the list of extension keys
  *
- * @param array $params API request params with 'key' or 'keys'
- * @return array of extension keys
+ * @param array $params
+ *   API request params with 'key' or 'keys'.
+ * @return array
+ *   Array of extension keys
  * @throws API_Exception
  */
 function _civicrm_api3_getKeys($params) {
   if (array_key_exists('keys', $params) && is_array($params['keys'])) {
     return $params['keys'];
-  } elseif (array_key_exists('keys', $params) && is_string($params['keys'])) {
+  }
+  elseif (array_key_exists('keys', $params) && is_string($params['keys'])) {
     if ($params['keys'] == '') {
       return array();
-    } else {
+    }
+    else {
       return explode(API_V3_EXTENSION_DELIMITER, $params['keys']);
     }
-  } elseif (array_key_exists('key', $params)) {
+  }
+  elseif (array_key_exists('key', $params)) {
     return array($params['key']);
-  } else {
+  }
+  else {
     throw new API_Exception('Missing required parameter: key or keys');
   }
 }