Completed
Pull Request — master (#8)
by Саша
21:35
created

CallbackTransformerSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 22
loc 22
rs 10
c 1
b 0
f 0

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\Extraload\Transformer;
4
5
use PhpSpec\ObjectBehavior;
6
use Prophecy\Argument;
7
8
class CallbackTransformerSpec extends ObjectBehavior
9
{
10
    function let()
11
    {
12
        $this->beConstructedWith('array_reverse');
13
    }
14
15
    function it_is_initializable()
16
    {
17
        $this->shouldHaveType('Extraload\Transformer\CallbackTransformer');
18
    }
19
20
    function it_implements_transformer_interface()
21
    {
22
        $this->shouldImplement('Extraload\Transformer\TransformerInterface');
23
    }
24
25
    function it_transforms_data_using_callback()
26
    {
27
        $this->transform(['foo', 'bar'])->shouldReturn(['bar', 'foo']);
28
    }
29
}
30