Completed
Pull Request — master (#24)
by
unknown
05:45 queued 03:36
created

CodeTablesSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 66.67 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 20
loc 30
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_provides_a_lazy_interface_to_codetable_objects() 10 10 1
A it_provides_a_lazy_array_interface_to_codetable_objects() 10 10 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 spec\Scriptotek\Alma\CodeTables;
4
5
use PhpSpec\ObjectBehavior;
6
use Prophecy\Argument;
7
use Scriptotek\Alma\Conf\CodeTable;
8
use Scriptotek\Alma\Client as AlmaClient;
9
use spec\Scriptotek\Alma\SpecHelper;
10
11
class CodeTablesSpec extends ObjectBehavior
12
{
13
    public function let(AlmaClient $client)
14
    {
15
        $this->beConstructedWith($client);
16
    }
17
18 View Code Duplication
    public function it_provides_a_lazy_interface_to_codetable_objects(AlmaClient $client)
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...
19
    {
20
        SpecHelper::expectNoRequests($client);
21
22
        $ctid = 'myCodeTable'; // str_random();
23
        $bib = $this->get($ctid);
24
25
        $bib->shouldHaveType(CodeTable::class);
26
        $bib->code->shouldBe($ctid);
27
    }
28
29 View Code Duplication
    public function it_provides_a_lazy_array_interface_to_codetable_objects(AlmaClient $client)
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
        SpecHelper::expectNoRequests($client);
32
33
        $ctid = 'myCodeTable'; // str_random();
34
        $ct = $this[$ctid];
35
36
        $ct->shouldHaveType(CodeTable::class);
37
        $ct->code->shouldBe($ctid);
38
    }
39
40
}
41