Merge remote-tracking branch 'upstream/4.6' into 4.6-master-2015-04-26-09-47-18
[civicrm-core.git] / CRM / Extension / Mapper.php
index 0766cf98dee4c7447e3bb1b6e2482a43b3a32b98..f765afb7a52a743de5ae727bed002ccbefa7d7c0 100755 (executable)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  * This class proivdes various helper functions for locating extensions
  * module-extensions.
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
 class CRM_Extension_Mapper {
 
   /**
-   * An URL for public extensions repository
+   * An URL for public extensions repository.
    */
   //const DEFAULT_EXTENSIONS_REPOSITORY = 'http://civicrm.org/extdir/ver={ver}|cms={uf}';
 
   /**
-   * Extension info file name
+   * Extension info file name.
    */
   const EXT_TEMPLATES_DIRNAME = 'templates';
 
@@ -118,7 +118,8 @@ class CRM_Extension_Mapper {
    * @param string $clazz
    *   Extension class name.
    *
-   * @return string name of extension key
+   * @return string
+   *   name of extension key
    */
   public function classToKey($clazz) {
     return str_replace('_', '.', $clazz);
@@ -130,7 +131,8 @@ class CRM_Extension_Mapper {
    *
    * @param $clazz
    *
-   * @return string full path the extension .php file
+   * @return string
+   *   full path the extension .php file
    */
   public function classToPath($clazz) {
     $elements = explode('_', $clazz);
@@ -145,7 +147,8 @@ class CRM_Extension_Mapper {
    * @param string $key
    *   A string which might be an extension key.
    *
-   * @return boolean true if given string is an extension name
+   * @return bool
+   *   true if given string is an extension name
    */
   public function isExtensionKey($key) {
     // check if the string is an extension name or the class
@@ -159,7 +162,8 @@ class CRM_Extension_Mapper {
    * @param string $clazz
    *   A string which might be an extension class name.
    *
-   * @return boolean true if given string is an extension class name
+   * @return bool
+   *   true if given string is an extension class name
    */
   public function isExtensionClass($clazz) {
 
@@ -201,7 +205,8 @@ class CRM_Extension_Mapper {
    * @param string $key
    *   Extension key.
    *
-   * @return string name of extension's main class
+   * @return string
+   *   name of extension's main class
    */
   public function keyToClass($key) {
     return str_replace('.', '_', $key);
@@ -215,7 +220,8 @@ class CRM_Extension_Mapper {
    * @param string $key
    *   Extension key.
    *
-   * @return string path to file containing extension's main class
+   * @return string
+   *   path to file containing extension's main class
    */
   public function keyToPath($key) {
     $info = $this->keyToInfo($key);
@@ -228,7 +234,8 @@ class CRM_Extension_Mapper {
    *
    * @param string $key
    *   Extension key.
-   * @return string local path of the extension source tree
+   * @return string
+   *   local path of the extension source tree
    */
   public function keyToBasePath($key) {
     if ($key == 'civicrm') {
@@ -245,7 +252,8 @@ class CRM_Extension_Mapper {
    * @param string $key
    *   Extension key.
    *
-   * @return string url for resources in this extension
+   * @return string
+   *   url for resources in this extension
    */
   public function keyToUrl($key) {
     if ($key == 'civicrm') {
@@ -264,9 +272,10 @@ class CRM_Extension_Mapper {
   /**
    * Fetch the list of active extensions of type 'module'
    *
-   * @param $fresh
-   *   Bool whether to forcibly reload extensions list from canonical store.
-   * @return array - array(array('prefix' => $, 'file' => $))
+   * @param bool $fresh
+   *   whether to forcibly reload extensions list from canonical store.
+   * @return array
+   *   array(array('prefix' => $, 'file' => $))
    */
   public function getActiveModuleFiles($fresh = FALSE) {
     $config = CRM_Core_Config::singleton();
@@ -316,9 +325,10 @@ class CRM_Extension_Mapper {
   }
 
   /**
-   * Get a list of base URLs for all active modules
+   * Get a list of base URLs for all active modules.
    *
-   * @return array (string $extKey => string $baseUrl)
+   * @return array
+   *   (string $extKey => string $baseUrl)
    */
   public function getActiveModuleUrls() {
     // TODO optimization/caching
@@ -351,7 +361,8 @@ class CRM_Extension_Mapper {
   /**
    * Get a list of all installed modules, including enabled and disabled ones
    *
-   * @return array CRM_Core_Module
+   * @return array
+   *   CRM_Core_Module
    */
   public function getModules() {
     $result = array();
@@ -371,7 +382,8 @@ class CRM_Extension_Mapper {
    * @param string $clazz
    *   Extension class name.
    *
-   * @return string path to extension's templates directory
+   * @return string
+   *   path to extension's templates directory
    */
   public function getTemplatePath($clazz) {
     $path = $this->container->getPath($this->classToKey($clazz));
@@ -381,7 +393,7 @@ class CRM_Extension_Mapper {
     $pathElm = explode(DIRECTORY_SEPARATOR, $path);
     array_pop($pathElm);
     return implode(DIRECTORY_SEPARATOR, $pathElm) . DIRECTORY_SEPARATOR . self::EXT_TEMPLATES_DIRNAME;
-    */
+     */
   }
 
   /**
@@ -392,7 +404,8 @@ class CRM_Extension_Mapper {
    * @param string $clazz
    *   Extension class name.
    *
-   * @return string extension's template name
+   * @return string
+   *   extension's template name
    */
   public function getTemplateName($clazz) {
     $info = $this->keyToInfo($this->classToKey($clazz));
@@ -406,4 +419,5 @@ class CRM_Extension_Mapper {
       $this->cache->delete($this->cacheKey . '/moduleFiles');
     }
   }
+
 }