Set version to 5.20.beta1
[civicrm-core.git] / CRM / Import / DataSource / CSV.php
index 63ab4ead8ad17755bf64e9da5bf3829054cb428f..69108e32629a3052c101f3d52a1002554f3bb301 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
  */
 class CRM_Import_DataSource_CSV extends CRM_Import_DataSource {
   const
@@ -41,7 +41,7 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource {
    *   collection of info about this data source
    */
   public function getInfo() {
-    return array('title' => ts('Comma-Separated Values (CSV)'));
+    return ['title' => ts('Comma-Separated Values (CSV)')];
   }
 
   /**
@@ -74,10 +74,10 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource {
     $form->assign('uploadSize', $uploadSize);
     $form->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
     $form->setMaxFileSize($uploadFileSize);
-    $form->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(
-          1 => $uploadSize,
-          2 => $uploadFileSize,
-        )), 'maxfilesize', $uploadFileSize);
+    $form->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', [
+      1 => $uploadSize,
+      2 => $uploadFileSize,
+    ]), 'maxfilesize', $uploadFileSize);
     $form->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
     $form->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
 
@@ -131,7 +131,7 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource {
     $table = NULL,
     $fieldSeparator = ','
   ) {
-    $result = array();
+    $result = [];
     $fd = fopen($file, 'r');
     if (!$fd) {
       CRM_Core_Error::fatal("Could not read $file");
@@ -192,7 +192,7 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource {
       }
     }
     else {
-      $columns = array();
+      $columns = [];
       foreach ($firstrow as $i => $_) {
         $columns[] = "col_$i";
       }
@@ -239,7 +239,7 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource {
         function($string) {
           return trim($string, chr(0xC2) . chr(0xA0));
         }, $row);
-      $row = array_map(array('CRM_Core_DAO', 'escapeString'), $row);
+      $row = array_map(['CRM_Core_DAO', 'escapeString'], $row);
       $sql .= "('" . implode("', '", $row) . "')";
       $count++;