Code Duplication    Length = 24-24 lines in 2 locations

src/Adapter/Goodby/Exporter.php 1 location

@@ 167-190 (lines=24) @@
164
     * @return void
165
     * @throws \Goodby\CSV\Export\Standard\Exception\StrictViolationException Is thrown, if row consistency check fails
166
     */
167
    private function checkRowConsistency(array $row)
168
    {
169
170
        // query whether or not strict mode is enabled
171
        if ($this->isNotStrict()) {
172
            return;
173
        }
174
175
        // count the number of columns
176
        $current = count($row);
177
178
        // if the row consistency has not been set, set it
179
        if ($this->rowConsistency === null) {
180
            $this->rowConsistency = $current;
181
        }
182
183
        // check row consistency
184
        if ($current !== $this->rowConsistency) {
185
            throw new StrictViolationException(sprintf('Column size should be %u, but %u columns given', $this->rowConsistency, $current));
186
        }
187
188
        // set the new row consistency
189
        $this->rowConsistency = $current;
190
    }
191
}
192

src/Adapter/Goodby/Interpreter.php 1 location

@@ 161-184 (lines=24) @@
158
     * @return void
159
     * @throws \Goodby\CSV\Export\Standard\Exception\StrictViolationException Is thrown, if row consistency check fails
160
     */
161
    private function checkRowConsistency(array $row)
162
    {
163
164
        // query whether or not strict mode is enabled
165
        if ($this->isNotStrict()) {
166
            return;
167
        }
168
169
        // count the number of columns
170
        $current = count($row);
171
172
        // if the row consistency has not been set, set it
173
        if ($this->rowConsistency === null) {
174
            $this->rowConsistency = $current;
175
        }
176
177
        // check row consistency
178
        if ($current !== $this->rowConsistency) {
179
            throw new StrictViolationException(sprintf('Column size should be %u, but %u columns given', $this->rowConsistency, $current));
180
        }
181
182
        // set the new row consistency
183
        $this->rowConsistency = $current;
184
    }
185
}
186