~ubuntu-branches/ubuntu/wily/symfony/wily

« back to all changes in this revision

Viewing changes to src/Symfony/Component/Console/Helper/Table.php

  • Committer: Package Import Robot
  • Author(s): David Prévot
  • Date: 2015-06-14 17:15:34 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: package-import@ubuntu.com-20150614171534-ta2n2x2hapjyq89h
Tags: upstream-2.7.1+dfsg
Import upstream version 2.7.1+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
385
385
        $unmergedRows = array();
386
386
        foreach ($rows[$line] as $column => $cell) {
387
387
            if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
388
 
                $nbLines = $cell->getRowspan()-1;
 
388
                $nbLines = $cell->getRowspan() - 1;
389
389
                $lines = array($cell);
390
390
                if (strstr($cell, "\n")) {
391
391
                    $lines = explode("\n", $cell);
412
412
                    array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
413
413
                }
414
414
            } else {
415
 
                $row = $this->copyRow($rows, $unmergedRowKey-1);
 
415
                $row = $this->copyRow($rows, $unmergedRowKey - 1);
416
416
                foreach ($unmergedRow as $column => $cell) {
417
417
                    if (!empty($cell)) {
418
418
                        $row[$column] = $unmergedRow[$column];
476
476
    {
477
477
        $columns = count($row);
478
478
        foreach ($row as $column) {
479
 
            $columns += $column instanceof TableCell ? ($column->getColspan()-1) : 0;
 
479
            $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
480
480
        }
481
481
 
482
482
        return $columns;
491
491
     */
492
492
    private function getRowColumns($row)
493
493
    {
494
 
        $columns = range(0, $this->numberOfColumns-1);
 
494
        $columns = range(0, $this->numberOfColumns - 1);
495
495
        foreach ($row as $cellKey => $cell) {
496
496
            if ($cell instanceof TableCell && $cell->getColspan() > 1) {
497
497
                // exclude grouped columns.
498
 
                $columns = array_diff($columns, range($cellKey+1, $cellKey + $cell->getColspan()-1));
 
498
                $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
499
499
            }
500
500
        }
501
501
 
550
550
    {
551
551
        if (isset($row[$column])) {
552
552
            $cell = $row[$column];
 
553
            $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
553
554
            if ($cell instanceof TableCell && $cell->getColspan() > 1) {
554
555
                // we assume that cell value will be across more than one column.
555
 
                $cell = substr($cell, 0, strlen($cell)/$cell->getColspan());
 
556
                $cellWidth = $cellWidth / $cell->getColspan();
556
557
            }
557
558
 
558
 
            return Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
 
559
            return $cellWidth;
559
560
        }
560
561
 
561
562
        return 0;