Completed
Pull Request — master (#40)
by
unknown
03:47 queued 01:55
created

LanguageStatusSpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 36 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 7 1
A it_should_be_an_api() 0 4 1
A it_gets_project_language_status() 9 9 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\Akeneo\Crowdin\Api;
4
5
use Akeneo\Crowdin\Client;
6
use GuzzleHttp\Client as HttpClient;
7
use GuzzleHttp\Psr7\Response;
8
use PhpSpec\ObjectBehavior;
9
use Prophecy\Argument;
10
11
class LanguageStatusSpec extends ObjectBehavior
12
{
13
    public function let(Client $client, HttpClient $http)
14
    {
15
        $client->getHttpClient()->willReturn($http);
16
        $client->getProjectIdentifier()->willReturn('akeneo');
17
        $client->getProjectApiKey()->willReturn('1234');
18
        $this->beConstructedWith($client);
19
    }
20
21
    public function it_should_be_an_api()
22
    {
23
        $this->shouldBeAnInstanceOf('Akeneo\Crowdin\Api\AbstractApi');
24
    }
25
26 View Code Duplication
    public function it_gets_project_language_status(
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...
27
        HttpClient $http,
28
        Response $response
29
    ) {
30
        $this->setLanguage('fr')->shouldBe($this);
31
        $http->post('project/akeneo/language-status?key=1234', ["language" => 'fr'])->willReturn($response);
32
        $response->getBody(true)->willReturn('<xml></xml>');
33
        $this->execute()->shouldBe('<xml></xml>');
34
    }
35
}
36