Add CRM.sigfig utility
[civicrm-core.git] / CRM / Utils / Api.php
index f5b1d02c6a5433c4248f1f2f67b3a928987e6a13..323eff97ab2d961c38a91d60b5871bceb7650bde 100644 (file)
@@ -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.                                    |
  |                                                                    |
@@ -44,41 +44,41 @@ class CRM_Utils_Api {
 
     // First try the obvious replacements
     $daoName = str_replace(array('_BAO_', '_Form_', '_Page_'), '_DAO_', $className);
-    $shortName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
+    $entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
 
     // If that didn't work, try a different pattern
-    if (!$shortName) {
+    if (!$entityName) {
       list(, $parent, , $child) = explode('_', $className);
       $daoName = "CRM_{$parent}_DAO_$child";
-      $shortName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
+      $entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
     }
 
     // If that didn't work, try a different pattern
-    if (!$shortName) {
+    if (!$entityName) {
       $daoName = "CRM_{$parent}_DAO_$parent";
-      $shortName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
+      $entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
     }
 
     // If that didn't work, try a different pattern
-    if (!$shortName) {
+    if (!$entityName) {
       $daoName = "CRM_Core_DAO_$child";
-      $shortName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
+      $entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
     }
 
     // If that didn't work, try using just the trailing name
-    if (!$shortName) {
-      $shortName = CRM_Core_DAO_AllCoreTables::getFullName($child) ? $child : NULL;
+    if (!$entityName) {
+      $entityName = CRM_Core_DAO_AllCoreTables::getFullName($child) ? $child : NULL;
     }
 
     // If that didn't work, try using just the leading name
-    if (!$shortName) {
-      $shortName = CRM_Core_DAO_AllCoreTables::getFullName($parent) ? $parent : NULL;
+    if (!$entityName) {
+      $entityName = CRM_Core_DAO_AllCoreTables::getFullName($parent) ? $parent : NULL;
     }
 
-    if (!$shortName) {
+    if (!$entityName) {
       throw new CRM_Core_Exception('Could not find api name for supplied class');
     }
-    return _civicrm_api_get_entity_name_from_camel($shortName);
+    return $entityName;
   }
 
 }