LocationPostMessageSpec   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
Duplicated Lines 84.62 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 44
loc 52
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A it_should_build() 44 44 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\Yproximite\Api\Message\Location;
4
5
use PhpSpec\ObjectBehavior;
6
7
use Yproximite\Api\Message\Location\LocationPostMessage;
8
use Yproximite\Api\Message\Location\LocationTranslationMessage;
9
10
class LocationPostMessageSpec extends ObjectBehavior
11
{
12
    function it_is_initializable()
13
    {
14
        $this->shouldHaveType(LocationPostMessage::class);
15
    }
16
17 View Code Duplication
    function it_should_build()
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...
18
    {
19
        $translation = new LocationTranslationMessage();
20
        $translation->setLocale('en');
21
        $translation->setTitle('Some location');
22
        $translation->setOpeningHours('24/7');
23
24
        $this->setTel('+1 123 456 78 90');
25
        $this->setTel2('+2 456 111 78 90');
26
        $this->setFax('+3 111 222 78 11');
27
        $this->setMail('[email protected]');
28
        $this->setAddress('88 St Patrick St');
29
        $this->setPostalCode('M5T 1V1');
30
        $this->setTown('Toronto');
31
        $this->setCountry('Canada');
32
        $this->setAddressForGoogleMap('88 St Patrick St, Toronto, M5T 1V1, Canada');
33
        $this->setDefaultLocation(true);
34
        $this->setLatitude('43.6527222');
35
        $this->setLongitude('-79.3918831');
36
        $this->addTranslation($translation);
37
38
        $translationData = [
39
            'title'        => 'Some location',
40
            'openingHours' => '24/7',
41
        ];
42
43
        $data = [
44
            'tel'                 => '+1 123 456 78 90',
45
            'tel2'                => '+2 456 111 78 90',
46
            'fax'                 => '+3 111 222 78 11',
47
            'mail'                => '[email protected]',
48
            'address'             => '88 St Patrick St',
49
            'postalCode'          => 'M5T 1V1',
50
            'town'                => 'Toronto',
51
            'country'             => 'Canada',
52
            'addressForGoogleMap' => '88 St Patrick St, Toronto, M5T 1V1, Canada',
53
            'defaultLocation'     => true,
54
            'latitude'            => '43.6527222',
55
            'longitude'           => '-79.3918831',
56
            'translations'        => ['en' => $translationData]
57
        ];
58
59
        $this->build()->shouldReturn($data);
60
    }
61
}
62