Completed
Branch master (6ce04d)
by Mathew
02:08
created

Coaster   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 88
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 9
c 2
b 0
f 1
lcom 1
cbo 1
dl 0
loc 88
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A getStyleId() 0 4 1
A getStyle() 0 4 1
A getNumberOfTrains() 0 4 1
A getMaxHeight() 0 4 1
A getMinHeight() 0 4 1
A getTrackLength() 0 4 1
A getTrackLengthWithoutStorage() 0 4 1
1
<?php
2
3
namespace Thepixeldeveloper\Nolimits2PackageLoader;
4
5
use SimpleXMLElement;
6
7
/**
8
 * Class Coaster
9
 *
10
 * @package Thepixeldeveloper\Nolimits2PackageLoader
11
 */
12
class Coaster
13
{
14
    /**
15
     * @var SimpleXMLElement
16
     */
17
    protected $coasterXML;
18
19
    /**
20
     * @var Styles
21
     */
22
    protected $styles;
23
24
    /**
25
     * Park constructor.
26
     *
27
     * @param SimpleXMLElement $simpleXMLElement
28
     * @param Styles $styles
29
     */
30
    public function __construct(SimpleXMLElement $simpleXMLElement, Styles $styles)
31
    {
32
        $this->coasterXML = $simpleXMLElement;
33
        $this->styles = $styles;
34
    }
35
36
    /**
37
     * @return string
38
     */
39
    public function getName()
40
    {
41
        return (string) $this->coasterXML->name;
42
    }
43
44
    /**
45
     * @return int
46
     */
47
    public function getStyleId()
48
    {
49
        return (int) $this->coasterXML->coasterstyleid;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getStyle()
56
    {
57
        return $this->styles->getLabel($this->getStyleId());
58
    }
59
60
    /**
61
     * @return int
62
     */
63
    public function getNumberOfTrains()
64
    {
65
        return (int) $this->coasterXML->numtrains;
66
    }
67
68
    /**
69
     * @return float
70
     */
71
    public function getMaxHeight()
72
    {
73
        return (double) $this->coasterXML->maxheight;
74
    }
75
76
    /**
77
     * @return float
78
     */
79
    public function getMinHeight()
80
    {
81
        return (double) $this->coasterXML->minheight;
82
    }
83
84
    /**
85
     * @return float
86
     */
87
    public function getTrackLength()
88
    {
89
        return (double) $this->coasterXML->tracklength;
90
    }
91
92
    /**
93
     * @return float
94
     */
95
    public function getTrackLengthWithoutStorage()
96
    {
97
        return (double) $this->coasterXML->tracklengthwostorage;
98
    }
99
}
100