X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FPaperSize.php;h=439ef42cd09b5b68ba67c3a4422942bebe336cd0;hb=8eedd10ab20e65fa8e17f2ea00d3c82c7f8d5aff;hp=796b9074c161a41624f6d58f7149c0f685bc5538;hpb=9d29f5f8596366df6a6ae99b97029da639e03004;p=civicrm-core.git diff --git a/CRM/Core/BAO/PaperSize.php b/CRM/Core/BAO/PaperSize.php index 796b9074c1..439ef42cd0 100644 --- a/CRM/Core/BAO/PaperSize.php +++ b/CRM/Core/BAO/PaperSize.php @@ -1,7 +1,7 @@ 1, 'is_default' => 1); @@ -149,12 +144,15 @@ class CRM_Core_BAO_PaperSize extends CRM_Core_DAO_OptionValue { } /** - * Get Paper Size from the DB + * Get Paper Size from the DB. * - * @param string $field Field name to search by - * @param int $val Field value to search for + * @param string $field + * Field name to search by. + * @param int $val + * Field value to search for. * - * @return array $values (reference) associative array of name/value pairs + * @return array + * (reference) associative array of name/value pairs */ public static function &getPaperFormat($field, $val) { $params = array('is_active' => 1, $field => $val); @@ -168,44 +166,48 @@ class CRM_Core_BAO_PaperSize extends CRM_Core_DAO_OptionValue { } /** - * Get Paper Size by Name + * Get Paper Size by Name. * - * @param int $name Paper Size name. Empty = get default Paper Size + * @param int $name + * Paper Size name. Empty = get default Paper Size. * - * @return array $values (reference) associative array of name/value pairs + * @return array + * (reference) associative array of name/value pairs */ public static function &getByName($name) { return self::getPaperFormat('name', $name); } /** - * Get Paper Size by ID + * Get Paper Size by ID. * - * @param int $id Paper Size id. 0 = get default Paper Size + * @param int $id + * Paper Size id. 0 = get default Paper Size. * - * @return array $values (reference) associative array of name/value pairs + * @return array + * (reference) associative array of name/value pairs */ public static function &getById($id) { return self::getPaperFormat('id', $id); } /** - * Get Paper Size field from associative array + * Get Paper Size field from associative array. * - * @param string $field name of a Paper Size field + * @param string $field + * Name of a Paper Size field. * @param array (reference) $values associative array of name/value pairs containing * Paper Size field selections * * @param null $default * * @return value - * @static */ public static function getValue($field, &$values, $default = NULL) { if (array_key_exists($field, self::$optionValueFields)) { switch (self::$optionValueFields[$field]['type']) { case CRM_Utils_Type::T_INT: - return (int)CRM_Utils_Array::value($field, $values, $default); + return (int) CRM_Utils_Array::value($field, $values, $default); case CRM_Utils_Type::T_FLOAT: // Round float values to three decimal places and trim trailing zeros. @@ -213,7 +215,7 @@ class CRM_Core_BAO_PaperSize extends CRM_Core_DAO_OptionValue { $f = sprintf('%05.3f', $values[$field]); $f = rtrim($f, '0'); $f = rtrim($f, '.'); - return (float)(empty($f) ? '0' : $f); + return (float) (empty($f) ? '0' : $f); } return CRM_Utils_Array::value($field, $values, $default); } @@ -221,15 +223,16 @@ class CRM_Core_BAO_PaperSize extends CRM_Core_DAO_OptionValue { } /** - * Takes a bunch of params that are needed to match certain criteria and - * retrieves the relevant objects. Typically the valid params are only - * paper size id. It also stores all the retrieved values in the default array. + * Retrieve DB object based on input parameters. * - * @param array $params (reference ) an assoc array of name/value pairs - * @param array $values (reference ) an assoc array to hold the flattened values + * It also stores all the retrieved values in the default array. * - * @return CRM_Core_DAO_OptionValue object - * @static + * @param array $params + * (reference ) an assoc array of name/value pairs. + * @param array $values + * (reference ) an assoc array to hold the flattened values. + * + * @return CRM_Core_DAO_OptionValue */ public static function retrieve(&$params, &$values) { $optionValue = new CRM_Core_DAO_OptionValue(); @@ -258,12 +261,11 @@ class CRM_Core_BAO_PaperSize extends CRM_Core_DAO_OptionValue { } /** - * Save the Paper Size in the DB - * - * @param array (reference) $values associative array of name/value pairs - * @param int $id id of the database record (null = new record) + * Save the Paper Size in the DB. * - * @return void + * @param array (reference) $values associative array of name/value pairs + * @param int $id + * Id of the database record (null = new record). */ public function savePaperSize(&$values, $id) { // get the Option Group ID for Paper Sizes (create one if it doesn't exist) @@ -317,11 +319,11 @@ class CRM_Core_BAO_PaperSize extends CRM_Core_DAO_OptionValue { } /** - * Delete a Paper Size + * Delete a Paper Size. * - * @param int $id ID of the Paper Size to be deleted. + * @param int $id + * ID of the Paper Size to be deleted. * - * @static */ public static function del($id) { if ($id) { @@ -338,4 +340,5 @@ class CRM_Core_BAO_PaperSize extends CRM_Core_DAO_OptionValue { } CRM_Core_Error::fatal(ts('Invalid value passed to delete function.')); } + }