Code Duplication    Length = 59-60 lines in 2 locations

src/Core/Components/ascene/Stats/StatsComponent.php 1 location

@@ 29-88 (lines=60) @@
26
use \AframeVR\Interfaces\Core\Components\ascene\StatsCMPTIF;
27
use \AframeVR\Core\Helpers\ComponentAbstract;
28
29
class StatsComponent extends ComponentAbstract implements StatsCMPTIF
30
{
31
32
    protected $dom_attribute;
33
    
34
    /**
35
     * Initialize Component
36
     *
37
     * {@inheritdoc}
38
     *
39
     * @return bool
40
     */
41
    public function initializeComponent(): bool
42
    {
43
        $this->setDomAttribute('stats');
44
        $this->set();
45
        return true;
46
    }
47
48
    /**
49
     * Entity visible
50
     *
51
     * {@inheritdoc}
52
     *
53
     * @param bool $visible
54
     * @return StatsCMPTIF
55
     */
56
    public function set(bool $visible = true): StatsCMPTIF
57
    {
58
        $this->dom_attribute = $visible ? 'true' : 'false';
59
        return $this;
60
    }
61
    
62
    /**
63
     * Does component have DOM Atributes
64
     * 
65
     * If compnent is called then we return true
66
     * 
67
     * {@inheritdoc}
68
     *
69
     * @return bool
70
     */
71
    public function hasDOMAttributes(): bool
72
    {
73
        return true;
74
    }
75
    
76
    /**
77
     * Return DOM attribute contents
78
     *
79
     * Scale Components dom atribute contains roll, pitch, yaw
80
     * Ex: rotation="1 1 1"
81
     *
82
     * @return string
83
     */
84
    public function getDomAttributeString(): string
85
    {
86
        return $this->dom_attribute;
87
    }
88
}

src/Core/Components/Visible/VisibleComponent.php 1 location

@@ 29-87 (lines=59) @@
26
use \AframeVR\Interfaces\Core\Components\VisibleCMPTIF;
27
use \AframeVR\Core\Helpers\ComponentAbstract;
28
29
class VisibleComponent extends ComponentAbstract implements VisibleCMPTIF
30
{
31
    protected $dom_attribute;
32
    
33
    /**
34
     * Initialize Component
35
     *
36
     * {@inheritdoc}
37
     *
38
     * @return bool
39
     */
40
    public function initializeComponent(): bool
41
    {
42
        $this->setDomAttribute('visible');
43
        $this->set();
44
        return true;
45
    }
46
47
    /**
48
     * Entity visible
49
     *
50
     * {@inheritdoc}
51
     *
52
     * @param bool $visible
53
     * @return VisibleCMPTIF
54
     */
55
    public function set(bool $visible = true): VisibleCMPTIF
56
    {
57
        $this->dom_attribute = $visible ? 'true' : 'false';
58
        return $this;
59
    }
60
    
61
    /**
62
     * Does component have DOM Atributes
63
     * 
64
     * If compnent is called then we return true
65
     * 
66
     * {@inheritdoc}
67
     *
68
     * @return bool
69
     */
70
    public function hasDOMAttributes(): bool
71
    {
72
        return true;
73
    }
74
    
75
    /**
76
     * Return DOM attribute contents
77
     *
78
     * Scale Components dom atribute contains roll, pitch, yaw
79
     * Ex: rotation="1 1 1"
80
     *
81
     * @return string
82
     */
83
    public function getDomAttributeString(): string
84
    {
85
        return $this->dom_attribute;
86
    }
87
}