Merge pull request #15411 from systopia/dev_l10nx
[civicrm-core.git] / CRM / Core / BAO / PdfFormat.php
index 14281573952fd1b0ddf63cf7f7f1fa2f753b8bc3..3a964f8cb929f7c6e5ae306bcad4eefb5626a6fc 100644 (file)
@@ -29,7 +29,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
  */
 
 /**
@@ -39,58 +39,60 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
 
   /**
    * Static holder for the PDF Page Formats Option Group ID.
+   * @var int
    */
   private static $_gid = NULL;
 
   /**
    * PDF Page Format fields stored in the 'value' field of the Option Value table.
+   * @var array
    */
-  private static $optionValueFields = array(
-    'paper_size' => array(
+  private static $optionValueFields = [
+    'paper_size' => [
       'name' => 'paper_size',
       'type' => CRM_Utils_Type::T_STRING,
       'default' => 'letter',
-    ),
-    'stationery' => array(
+    ],
+    'stationery' => [
       'name' => 'stationery',
       'type' => CRM_Utils_Type::T_STRING,
       'default' => '',
-    ),
-    'orientation' => array(
+    ],
+    'orientation' => [
       'name' => 'orientation',
       'type' => CRM_Utils_Type::T_STRING,
       'default' => 'portrait',
-    ),
-    'metric' => array(
+    ],
+    'metric' => [
       'name' => 'metric',
       'type' => CRM_Utils_Type::T_STRING,
       'default' => 'in',
-    ),
-    'margin_top' => array(
+    ],
+    'margin_top' => [
       'name' => 'margin_top',
       'type' => CRM_Utils_Type::T_FLOAT,
       'metric' => TRUE,
       'default' => 0.75,
-    ),
-    'margin_bottom' => array(
+    ],
+    'margin_bottom' => [
       'name' => 'margin_bottom',
       'type' => CRM_Utils_Type::T_FLOAT,
       'metric' => TRUE,
       'default' => 0.75,
-    ),
-    'margin_left' => array(
+    ],
+    'margin_left' => [
       'name' => 'margin_left',
       'type' => CRM_Utils_Type::T_FLOAT,
       'metric' => TRUE,
       'default' => 0.75,
-    ),
-    'margin_right' => array(
+    ],
+    'margin_right' => [
       'name' => 'margin_right',
       'type' => CRM_Utils_Type::T_FLOAT,
       'metric' => TRUE,
       'default' => 0.75,
-    ),
-  );
+    ],
+  ];
 
   /**
    * Get page orientations recognized by the DOMPDF package used to create PDF letters.
@@ -99,10 +101,10 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
    *   array of page orientations
    */
   public static function getPageOrientations() {
-    return array(
+    return [
       'portrait' => ts('Portrait'),
       'landscape' => ts('Landscape'),
-    );
+    ];
   }
 
   /**
@@ -112,12 +114,12 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
    *   array of measurement units
    */
   public static function getUnits() {
-    return array(
+    return [
       'in' => ts('Inches'),
       'cm' => ts('Centimeters'),
       'mm' => ts('Millimeters'),
       'pt' => ts('Points'),
-    );
+    ];
   }
 
   /**
@@ -139,7 +141,7 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
   /**
    * Add ordering fields to Page Format list.
    *
-   * @param array (reference) $list List of PDF Page Formats
+   * @param array $list List of PDF Page Formats
    * @param string $returnURL
    *   URL of page calling this function.
    */
@@ -158,7 +160,7 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
    *   (reference)   PDF Page Format list
    */
   public static function &getList($namesOnly = FALSE) {
-    static $list = array();
+    static $list = [];
     if (self::_getGid()) {
       // get saved PDF Page Formats from Option Value table
       $dao = new CRM_Core_DAO_OptionValue();
@@ -185,13 +187,13 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
    *   Name/value pairs containing the default PDF Page Format values.
    */
   public static function &getDefaultValues() {
-    $params = array('is_active' => 1, 'is_default' => 1);
-    $defaults = array();
+    $params = ['is_active' => 1, 'is_default' => 1];
+    $defaults = [];
     if (!self::retrieve($params, $defaults)) {
       foreach (self::$optionValueFields as $name => $field) {
         $defaults[$name] = $field['default'];
       }
-      $filter = array('option_group_id' => self::_getGid());
+      $filter = ['option_group_id' => self::_getGid()];
       $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $filter);
 
       // also set the id to avoid NOTICES, CRM-8454
@@ -212,8 +214,8 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
    *   (reference) associative array of name/value pairs
    */
   public static function &getPdfFormat($field, $val) {
-    $params = array('is_active' => 1, $field => $val);
-    $pdfFormat = array();
+    $params = ['is_active' => 1, $field => $val];
+    $pdfFormat = [];
     if (self::retrieve($params, $pdfFormat)) {
       return $pdfFormat;
     }
@@ -253,7 +255,7 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
    *
    * @param string $field
    *   Name of a PDF Page Format field.
-   * @param array (reference) $values associative array of name/value pairs containing
+   * @param array $values associative array of name/value pairs containing
    *                                           PDF Page Format field selections
    *
    * @param null $default
@@ -367,7 +369,7 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
     $this->save();
 
     // fix duplicate weights
-    $filter = array('option_group_id' => self::_getGid());
+    $filter = ['option_group_id' => self::_getGid()];
     CRM_Utils_Weight::correctDuplicateWeights('CRM_Core_DAO_OptionValue', $filter);
   }
 
@@ -384,7 +386,7 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
       $dao->id = $id;
       if ($dao->find(TRUE)) {
         if ($dao->option_group_id == self::_getGid()) {
-          $filter = array('option_group_id' => self::_getGid());
+          $filter = ['option_group_id' => self::_getGid()];
           CRM_Utils_Weight::delWeight('CRM_Core_DAO_OptionValue', $id, $filter);
           $dao->delete();
           return;