Passed
Push — master ( 4e36c0...26f6ea )
by David
01:34
created

PlaceType   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 61
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A setName() 0 4 1
A getName() 0 3 1
A getOriginalWeight() 0 3 1
A __toString() 0 3 1
1
<?php
2
3
namespace GGGGino\WarehousePath\Entity;
4
5
abstract class PlaceType
6
{
7
    /**
8
     * An identifier to recognize the node
9
     *
10
     * @var string
11
     */
12
    protected $name;
13
14
    /**
15
     * Original Weight given on instantiation
16
     *
17
     * @var int
18
     */
19
    protected $originalWeight = 0;
20
21
    /**
22
     * Place constructor.
23
     * @param string $name
24
     */
25
    public function __construct($name = "")
26
    {
27
        $this->name = $name;
28
    }
29
30
    public function __toString()
31
    {
32
        return $this->getOriginalWeight();
33
    }
34
35
    /**
36
     * Describe if the place will be walkable or not
37
     *
38
     * @return boolean
39
     */
40
    abstract public function isWalkable();
41
42
    /**
43
     * @return string
44
     */
45
    public function getName()
46
    {
47
        return $this->name;
48
    }
49
50
    /**
51
     * @param string $name
52
     * @return PlaceType
53
     */
54
    public function setName($name)
55
    {
56
        $this->name = $name;
57
        return $this;
58
    }
59
60
    /**
61
     * @return int
62
     */
63
    public function getOriginalWeight()
64
    {
65
        return $this->originalWeight;
66
    }
67
}