Code Duplication    Length = 45-45 lines in 2 locations

src/Core/Components/ascene/VRmodeUI/VRmodeUIComponent.php 1 location

@@ 29-73 (lines=45) @@
26
use \AframeVR\Interfaces\Core\Components\ascene\VRmodeUICMPTIF;
27
use \AframeVR\Core\Helpers\ComponentAbstract;
28
29
class VRmodeUIComponent extends ComponentAbstract implements VRmodeUICMPTIF
30
{
31
32
    /**
33
     * Initialize Component
34
     *
35
     * {@inheritdoc}
36
     *
37
     * @return bool
38
     */
39
    public function initializeComponent(): bool
40
    {
41
        $this->setDomAttribute('vr-mode-ui');
42
        $this->enabled();
43
        return true;
44
    }
45
46
    /**
47
     * look-controls enabled
48
     *
49
     * {@inheritdoc}
50
     *
51
     * @param bool $enabled            
52
     * @return VRmodeUICMPTIF
53
     */
54
    public function enabled(bool $enabled = true): VRmodeUICMPTIF
55
    {
56
        $this->dom_attributes['enabled'] = $enabled ? 'true' : 'false';
57
        return $this;
58
    }
59
    
60
    /**
61
     * Does component have DOM Atributes
62
     *
63
     * If compnent is called then we return true
64
     *
65
     * {@inheritdoc}
66
     *
67
     * @return bool
68
     */
69
    public function hasDOMAttributes(): bool
70
    {
71
        return true;
72
    }
73
}
74

src/Core/Components/LookControls/LookControlsComponent.php 1 location

@@ 29-73 (lines=45) @@
26
use \AframeVR\Interfaces\Core\Components\LookControlsCMPTIF;
27
use \AframeVR\Core\Helpers\ComponentAbstract;
28
29
class LookControlsComponent extends ComponentAbstract implements LookControlsCMPTIF
30
{
31
32
    /**
33
     * Does component have DOM Atributes
34
     *
35
     * If compnent is called then we return true
36
     *
37
     * {@inheritdoc}
38
     *
39
     * @return bool
40
     */
41
    public function hasDOMAttributes(): bool
42
    {
43
        return true;
44
    }
45
46
    /**
47
     * Initialize Component
48
     *
49
     * {@inheritdoc}
50
     *
51
     * @return bool
52
     */
53
    public function initializeComponent(): bool
54
    {
55
        $this->setDomAttribute('look-controls');
56
        $this->enabled();
57
        return true;
58
    }
59
60
    /**
61
     * look-controls enabled
62
     *
63
     * {@inheritdoc}
64
     *
65
     * @param bool $enabled            
66
     * @return LookControlsCMPTIF
67
     */
68
    public function enabled(bool $enabled = true): LookControlsCMPTIF
69
    {
70
        $this->dom_attributes['enabled'] = $enabled ? 'true' : 'false';
71
        return $this;
72
    }
73
}
74