Completed
Branch master (fb685e)
by Marko
02:00
created

Component   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 28
loc 28
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initializeComponent() 5 5 1
A getDomAttributeString() 5 5 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
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jun 25, 2016 - 7:51:42 PM
5
 * Contact      [email protected]
6
 * @copyright   2016 Marko Kungla - https://github.com/mkungla
7
 * @license     The MIT License (MIT)
8
 * 
9
 * @category       AframeVR
10
 * @package        aframe-php
11
 * 
12
 * Lang         PHP (php version >= 7)
13
 * Encoding     UTF-8
14
 * File         PositionComponent.php
15
 * Code format  PSR-2 and 12
16
 * @link        https://github.com/mkungla/aframe-php
17
 ^ @issues      https://github.com/mkungla/aframe-php/issues
18
 * ********************************************************************
19
 * Contributors:
20
 * @author Marko Kungla <[email protected]>
21
 * ********************************************************************
22
 * Comments:
23
 * @formatter:on */
24
namespace AframeVR\Core\Components\Scale;
25
26
use \AframeVR\Core\Helpers\ComponentAbstract;
27
use \AframeVR\Core\Helpers\ComponentHelper;
28
use \AframeVR\Interfaces\ComponentInterface;
29
30 View Code Duplication
class Component extends ComponentAbstract implements ComponentInterface
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...
31
{
32
    use ComponentHelper;
33
34
    /**
35
     * Initialize Component
36
     *
37
     * {@inheritdoc}
38
     *
39
     * @return bool
40
     */
41 51
    public function initializeComponent(): bool
42
    {
43 51
        $this->setDomAttributeName('scale');
44 51
        return true;
45
    }
46
47
    /**
48
     * Return DOM attribute contents
49
     *
50
     * @return string
51
     */
52 5
    public function getDomAttributeString(): string
53
    {
54 5
        $attrs = $this->getDOMAttributesArray();
55 5
        return $this->createCoordinateString($attrs['x'], $attrs['y'], $attrs['z']);
56
    }
57
}
58