Completed
Push — master ( 94f348...ce557b )
by Marko
02:44
created

Aframe   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 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\Scene;
27
28
final class Aframe
29
{
30
31
    /**
32
     * A-Frame Scenes
33
     *
34
     * All scenes will be in this array as Scene objects with index of custom identifier.
35
     *
36
     * @var $scenes
37
     */
38
    private $scenes;
39
40
    /**
41
     * Constructor
42
     */
43 10
    public function __construct()
44
    {
45
        /* We will have scenes in array */
46 10
        $this->scenes = array();
47 10
    }
48
49
    /**
50
     * Scene
51
     *
52
     * Work with untitled scene or scene by name
53
     *
54
     * @param string $name            
55
     * @return Scene
56
     */
57 9
    public function scene(string $name = 'untitled'): Scene
58
    {
59 9
        return $this->scenes[$name] ?? $this->scenes[$name] = new Scene($name);
60
    }
61
}
62