BrickHouse   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 81.82%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 48
loc 48
ccs 9
cts 11
cp 0.8182
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A getHeight() 4 4 1
A getWidth() 4 4 1
A getMaterial() 4 4 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
declare(strict_types=1);
3
4
namespace codenixsv\Patterns\Creational\FactoryMethod;
5
6
/**
7
 * Class BrickHouse
8
 * @package codenixsv\Patterns\Creational\FactoryMethod
9
 */
10 View Code Duplication
class BrickHouse implements HouseInterface
0 ignored issues
show
Duplication introduced by
This class 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...
11
{
12
    /**
13
     * @var int
14
     */
15
    private $width;
16
17
    /**
18
     * @var int
19
     */
20
    private $height;
21
22
    /**
23
     * @var string
24
     */
25
    private $material;
26
27 1
    public function __construct(int $width, int $height)
28
    {
29 1
        $this->height = $height;
30 1
        $this->width = $width;
31 1
        $this->material = 'bricks';
32 1
    }
33
34
    /**
35
     * @return int
36
     */
37 1
    public function getHeight(): int
38
    {
39 1
        return $this->height;
40
    }
41
42
    /**
43
     * @return int
44
     */
45 1
    public function getWidth(): int
46
    {
47 1
        return $this->width;
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getMaterial(): string
54
    {
55
        return $this->material;
56
    }
57
}
58