Code Duplication    Length = 16-16 lines in 3 locations

src/UI/Component/Table.php 3 locations

@@ 78-93 (lines=16) @@
75
     * @throws LogicException If the row contains more or less columns than
76
     *                        rows previously added to the table.
77
     */
78
    public function setHeaderRow(array $row)
79
    {
80
        if (null === $this->nbColumns) {
81
            $this->nbColumns = count($row);
82
        } elseif (count($row) !== $this->nbColumns) {
83
            throw new LogicException(sprintf(
84
                'Expected the header row to contain %s cells, but got %s.',
85
                $this->nbColumns,
86
                count($row)
87
            ));
88
        }
89
90
        $this->headerRow = array_values($row);
91
92
        return $this;
93
    }
94
95
    /**
96
     * Adds a row to the table.
@@ 105-120 (lines=16) @@
102
     * @throws LogicException If the row contains more or less columns than
103
     *                        rows previously added to the table.
104
     */
105
    public function addRow(array $row)
106
    {
107
        if (null === $this->nbColumns) {
108
            $this->nbColumns = count($row);
109
        } elseif (count($row) !== $this->nbColumns) {
110
            throw new LogicException(sprintf(
111
                'Expected the row to contain %s cells, but got %s.',
112
                $this->nbColumns,
113
                count($row)
114
            ));
115
        }
116
117
        $this->rows[] = array_values($row);
118
119
        return $this;
120
    }
121
122
    /**
123
     * Adds rows to the table.
@@ 171-186 (lines=16) @@
168
     * @throws LogicException If the row contains more or less columns than
169
     *                        rows previously added to the table.
170
     */
171
    public function setRow($index, array $row)
172
    {
173
        if (null === $this->nbColumns) {
174
            $this->nbColumns = count($row);
175
        } elseif (count($row) !== $this->nbColumns) {
176
            throw new LogicException(sprintf(
177
                'Expected the row to contain %s cells, but got %s.',
178
                $this->nbColumns,
179
                count($row)
180
            ));
181
        }
182
183
        $this->rows[$index] = array_values($row);
184
185
        return $this;
186
    }
187
188
    /**
189
     * Renders the table.