Aframe   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 51
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A config() 0 4 1
A scene() 0 4 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jun 20, 2016 - 8:45:32 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         Aframe.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;
25
26
use \AframeVR\Core\{
27
    Config,
28
    Scene
29
};
30
31
final class Aframe
32
{
33
34
    /**
35
     * A-Frame Scenes
36
     *
37
     * All scenes will be in this array as Scene objects with index of custom identifier.
38
     *
39
     * @var array $scenes
40
     */
41
    private $scenes = array();
42
43
    /**
44
     * Configuration Object
45
     * 
46
     * @var \AframeVR\Core\Config $configObj
47
     */
48
    private $configObj;
49
50
    /**
51
     * A-Frame PHP Constructor
52
     */
53 105
    public function __construct()
54
    {
55
        /* Initialize configuration */
56 105
        $this->config();
57 105
    }
58
    
59
    /**
60
     * Get Config
61
     * 
62
     * @return \AframeVR\Core\Config
63
     */
64 105
    public function config()
65
    {
66 105
        return $this->configObj ?? $this->configObj = new Config();
67
    }
68
69
    /**
70
     * Scene
71
     *
72
     * Work with untitled scene or scene by keyword
73
     *
74
     * @param string $keyword            
75
     * @return \AframeVR\Core\Scene
76
     */
77 103
    public function scene(string $keyword = 'untitled'): Scene
78
    {
79 103
        return $this->scenes[$keyword] ?? $this->scenes[$keyword] = new Scene($keyword, $this->config());
80
    }
81
}
82