Completed
Push — master ( 44e5f7...e8b22d )
by Marko
9s
created

ObjModel   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A obj() 0 5 1
A mtl() 0 5 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jul 7, 2016 - 9:24:33 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         ObjModel.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\Extras\Primitives;
25
26
use \AframeVR\Interfaces\Extras\Primitives\ObjModelPrimitiveIF;
27
use \AframeVR\Core\Entity;
28
use \AframeVR\Core\Helpers\MeshAttributes;
29
30
/**
31
 * <a-obj-model>
32
 *
33
 * The .OBJ model primitive displays a 3D Wavefront model. It is an entity that maps the src and mtl attributes to the
34
 * obj-model component’s obj and mtl properties respectively.
35
 */
36
final class ObjModel extends Entity implements ObjModelPrimitiveIF
37
{
38
    
39
    use MeshAttributes;
40
41
    /**
42
     * Selector to obj
43
     *
44
     * Selector to an <a-asset-item> pointing to a .OBJ file or an inline path to a .OBJ file.
45
     *
46
     * @param null|string $selector            
47
     * @return ObjModelPrimitiveIF
48
     */
49 4
    public function obj(string $selector = null): ObjModelPrimitiveIF
50
    {
51 4
        $this->component('ObjModel')->obj($selector);
52 4
        return $this;
53
    }
54
55
    /**
56
     * Selector to mtl
57
     *
58
     * Selector to an <a-asset-item> pointing to a .MTL file or an inline path to a .MTL file. Optional if you wish to
59
     * use the material component instead.
60
     *
61
     * @param null|string $selector            
62
     * @return ObjModelPrimitiveIF
63
     */
64 4
    public function mtl(string $selector = null): ObjModelPrimitiveIF
65
    {
66 4
        $this->component('ObjModel')->mtl($selector);
67 4
        return $this;
68
    }
69
}