X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FSQL%2FInsert.php;h=816c89f605d0079eb949a02d1e2be230c31473f5;hb=394301964aa0322991744072dccbe6577abb0c47;hp=fc8f1363583049ef5cded399acfd1190ad8ac363;hpb=fdbbaeee16125840b9e5daed81dbbb28e2db2b21;p=civicrm-core.git diff --git a/CRM/Utils/SQL/Insert.php b/CRM/Utils/SQL/Insert.php index fc8f136358..816c89f605 100644 --- a/CRM/Utils/SQL/Insert.php +++ b/CRM/Utils/SQL/Insert.php @@ -36,6 +36,7 @@ class CRM_Utils_SQL_Insert { /** * Array list of column names + * @var array */ private $columns; @@ -59,10 +60,11 @@ class CRM_Utils_SQL_Insert { */ public static function dao(CRM_Core_DAO $dao) { $table = CRM_Core_DAO::getLocaleTableName($dao->getTableName()); - $row = array(); + $row = []; foreach ((array) $dao as $key => $value) { if ($value === 'null') { - $value = NULL; // Blerg!!! + // Blerg!!! + $value = NULL; } // Skip '_foobar' and '{\u00}*_options' and 'N'. if (preg_match('/[a-zA-Z]/', $key{0}) && $key !== 'N') { @@ -80,7 +82,7 @@ class CRM_Utils_SQL_Insert { */ public function __construct($table) { $this->table = $table; - $this->rows = array(); + $this->rows = []; } /** @@ -128,11 +130,11 @@ class CRM_Utils_SQL_Insert { sort($columns); $this->columns = $columns; } - elseif (array_diff($this->columns, $columns) !== array()) { + elseif (array_diff($this->columns, $columns) !== []) { throw new CRM_Core_Exception("Inconsistent column names"); } - $escapedRow = array(); + $escapedRow = []; foreach ($this->columns as $column) { $escapedRow[$column] = $this->escapeString($row[$column]); }