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

Coaster::getNumberOfTrains()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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