INFRA-132 - Change "else if" to "elseif"
[civicrm-core.git] / CRM / Utils / PDF / Label.php
index b16272acfd5bf2c0c50e6f3280d9d573104d004a..8893b2a29da717ecdb68ee6f0ef71ec297872235 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  */
 
 require_once 'tcpdf/tcpdf.php';
+
+/**
+ * Class CRM_Utils_PDF_Label
+ */
 class CRM_Utils_PDF_Label extends TCPDF {
 
   // make these properties public due to
@@ -89,13 +93,13 @@ class CRM_Utils_PDF_Label extends TCPDF {
   /**
    * Constructor
    *
-   * @param $format   Either the name of a Label Format in the Option Value table
+   * @param $format
+   *   Either the name of a Label Format in the Option Value table.
    *                  or an array of Label Format values.
-   * @param $unit     Unit of measure for the PDF document
+   * @param string|\Unit $unit Unit of measure for the PDF document
    *
-   * @access public
    */
-  function __construct($format, $unit = 'mm') {
+  public function __construct($format, $unit = 'mm') {
     if (is_array($format)) {
       // Custom format
       $tFormat = $format;
@@ -116,12 +120,22 @@ class CRM_Utils_PDF_Label extends TCPDF {
     $this->setPrintFooter(FALSE);
   }
 
-  function SetGenerator($objectinstance, $methodname = 'generateLabel') {
+  /**
+   * @param $objectinstance
+   * @param string $methodname
+   */
+  public function SetGenerator($objectinstance, $methodname = 'generateLabel') {
     $this->generatorMethod = $methodname;
     $this->generatorObject = $objectinstance;
   }
 
-  function getFormatValue($name, $convert = FALSE) {
+  /**
+   * @param string $name
+   * @param bool $convert
+   *
+   * @return float|int|mixed
+   */
+  public function getFormatValue($name, $convert = FALSE) {
     if (isset($this->format[$name])) {
       $value = $this->format[$name];
       $metric = $this->format['metric'];
@@ -137,9 +151,13 @@ class CRM_Utils_PDF_Label extends TCPDF {
   }
 
   /*
-   * Function to initialize label format settings
+   * initialize label format settings
    */
-  function LabelSetFormat(&$format, $unit) {
+  /**
+   * @param $format
+   * @param $unit
+   */
+  public function LabelSetFormat(&$format, $unit) {
     $this->defaults = CRM_Core_BAO_LabelFormat::getDefaultValues();
     $this->format = &$format;
     $this->formatName = $this->getFormatValue('name');
@@ -166,9 +184,12 @@ class CRM_Utils_PDF_Label extends TCPDF {
   }
 
   /*
-   * function to Generate the pdf of one label (can be modified using SetGenerator)
+   * Generate the pdf of one label (can be modified using SetGenerator)
+   */
+  /**
+   * @param $text
    */
-  function generateLabel($text) {
+  public function generateLabel($text) {
     $args = array(
       'w' => $this->width,
       'h' => 0,
@@ -210,9 +231,12 @@ class CRM_Utils_PDF_Label extends TCPDF {
   }
 
   /*
-   * function to Print a label
+   * Print a label
    */
-  function AddPdfLabel($texte) {
+  /**
+   * @param $texte
+   */
+  public function AddPdfLabel($texte) {
     if ($this->countX == $this->xNumber) {
       // Page full, we start a new one
       $this->AddPage();
@@ -238,7 +262,7 @@ class CRM_Utils_PDF_Label extends TCPDF {
     }
   }
 
-  function getFontNames() {
+  public function getFontNames() {
     // Define labels for TCPDF core fonts
     $fontLabel = array(
       'courier' => ts('Courier'),
@@ -247,7 +271,6 @@ class CRM_Utils_PDF_Label extends TCPDF {
       'dejavusans' => ts('Deja Vu Sans (UTF-8)'),
     );
 
-
     // Check to see if we have any additional fonts to add. You can specify more fonts in
     // civicrm.settings.php via: $config['CiviCRM Preferences']['additional_fonts']
     // CRM-13307
@@ -266,4 +289,3 @@ class CRM_Utils_PDF_Label extends TCPDF {
     return $list;
   }
 }
-