Passed
Push — master ( a32b7c...9671df )
by Andy
02:16
created

RowTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 82.76 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 24
loc 29
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testRowArrayAccess() 8 8 1
A testRowCounting() 8 8 1
A testRowIsTraversable() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Palmtree\Csv\Test\Row;
4
5
use Palmtree\Csv\Reader;
6
use Palmtree\Csv\Row\Row;
7
use PHPUnit\Framework\TestCase;
8
9
class RowTest extends TestCase
10
{
11 View Code Duplication
    public function testRowArrayAccess()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
    {
13
        $reader = new Reader('php://memory', false);
14
15
        $row = new Row(['foo', 'bar'], $reader);
16
17
        $this->assertEquals('bar', $row[1]);
18
    }
19
20 View Code Duplication
    public function testRowCounting()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
    {
22
        $reader = new Reader('php://memory', false);
23
24
        $row = new Row(['foo', 'bar'], $reader);
25
26
        $this->assertCount(2, $row);
27
    }
28
29 View Code Duplication
    public function testRowIsTraversable()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
    {
31
        $reader = new Reader('php://memory', false);
32
33
        $row = new Row(['foo', 'bar'], $reader);
34
35
        $this->assertTrue(is_iterable($row));
36
    }
37
}
38