Mercurial > hg > isophonics-drupal-site
comparison vendor/pear/console_table/Table.php @ 12:7a779792577d
Update Drupal core to v8.4.5 (via Composer)
author | Chris Cannam |
---|---|
date | Fri, 23 Feb 2018 15:52:07 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
11:bfffd8d7479a | 12:7a779792577d |
---|---|
645 $vertical = $this->_border['vertical']; | 645 $vertical = $this->_border['vertical']; |
646 $separator = $this->_getSeparator(); | 646 $separator = $this->_getSeparator(); |
647 | 647 |
648 $return = array(); | 648 $return = array(); |
649 for ($i = 0; $i < count($this->_data); $i++) { | 649 for ($i = 0; $i < count($this->_data); $i++) { |
650 for ($j = 0; $j < count($this->_data[$i]); $j++) { | 650 if (is_array($this->_data[$i])) { |
651 if ($this->_data[$i] !== CONSOLE_TABLE_HORIZONTAL_RULE && | 651 for ($j = 0; $j < count($this->_data[$i]); $j++) { |
652 $this->_strlen($this->_data[$i][$j]) < | 652 if ($this->_data[$i] !== CONSOLE_TABLE_HORIZONTAL_RULE && |
653 $this->_cell_lengths[$j]) { | 653 $this->_strlen($this->_data[$i][$j]) < |
654 $this->_data[$i][$j] = $this->_strpad($this->_data[$i][$j], | 654 $this->_cell_lengths[$j]) { |
655 $this->_cell_lengths[$j], | 655 $this->_data[$i][$j] = $this->_strpad($this->_data[$i][$j], |
656 ' ', | 656 $this->_cell_lengths[$j], |
657 $this->_col_align[$j]); | 657 ' ', |
658 $this->_col_align[$j]); | |
659 } | |
658 } | 660 } |
659 } | 661 } |
660 | 662 |
661 if ($this->_data[$i] !== CONSOLE_TABLE_HORIZONTAL_RULE) { | 663 if ($this->_data[$i] !== CONSOLE_TABLE_HORIZONTAL_RULE) { |
662 $row_begin = $this->_borderVisibility['left'] | 664 $row_begin = $this->_borderVisibility['left'] |
784 * @return void | 786 * @return void |
785 */ | 787 */ |
786 function _updateRowsCols($rowdata = null) | 788 function _updateRowsCols($rowdata = null) |
787 { | 789 { |
788 // Update maximum columns. | 790 // Update maximum columns. |
789 $this->_max_cols = max($this->_max_cols, count($rowdata)); | 791 $this->_max_cols = max($this->_max_cols, is_array($rowdata) ? count($rowdata) : 0); |
790 | 792 |
791 // Update maximum rows. | 793 // Update maximum rows. |
792 ksort($this->_data); | 794 ksort($this->_data); |
793 $keys = array_keys($this->_data); | 795 $keys = array_keys($this->_data); |
794 $this->_max_rows = end($keys) + 1; | 796 $this->_max_rows = end($keys) + 1; |
820 * | 822 * |
821 * @return void | 823 * @return void |
822 */ | 824 */ |
823 function _calculateCellLengths($row) | 825 function _calculateCellLengths($row) |
824 { | 826 { |
825 for ($i = 0; $i < count($row); $i++) { | 827 if (is_array($row)) { |
826 if (!isset($this->_cell_lengths[$i])) { | 828 for ($i = 0; $i < count($row); $i++) { |
827 $this->_cell_lengths[$i] = 0; | 829 if (!isset($this->_cell_lengths[$i])) { |
828 } | 830 $this->_cell_lengths[$i] = 0; |
829 $this->_cell_lengths[$i] = max($this->_cell_lengths[$i], | 831 } |
830 $this->_strlen($row[$i])); | 832 $this->_cell_lengths[$i] = max($this->_cell_lengths[$i], |
833 $this->_strlen($row[$i])); | |
834 } | |
831 } | 835 } |
832 } | 836 } |
833 | 837 |
834 /** | 838 /** |
835 * Calculates the maximum height for all columns of a row. | 839 * Calculates the maximum height for all columns of a row. |