1 | <?php |
||
37 | class Reducao extends Normal |
||
38 | { |
||
39 | |||
40 | private $reducao; |
||
41 | |||
42 | 38 | public function __construct($reducao = array()) |
|
47 | |||
48 | 17 | public function getReducao($normalize = false) |
|
55 | |||
56 | 38 | public function setReducao($reducao) |
|
57 | { |
||
58 | 38 | if (trim($reducao) != '') { |
|
59 | 15 | $reducao = floatval($reducao); |
|
60 | 15 | } |
|
61 | 38 | $this->reducao = $reducao; |
|
62 | 38 | return $this; |
|
63 | } |
||
64 | |||
65 | /** |
||
66 | * Calcula o valor do reduzido da base de cálculo |
||
67 | */ |
||
68 | 5 | public function getReduzido($normalize = false) |
|
69 | { |
||
70 | 5 | if ($normalize) { |
|
71 | return Util::toCurrency($this->getReduzido()); |
||
72 | } |
||
73 | 5 | return ($this->getBase() * (100.0 - $this->getReducao())) / 100.0; |
|
74 | } |
||
75 | |||
76 | 4 | public function toArray() |
|
82 | |||
83 | 38 | public function fromArray($reducao = array()) |
|
84 | { |
||
85 | 38 | if ($reducao instanceof Reducao) { |
|
86 | 1 | $reducao = $reducao->toArray(); |
|
87 | 38 | } elseif (!is_array($reducao)) { |
|
88 | 1 | return $this; |
|
89 | } |
||
90 | 38 | parent::fromArray($reducao); |
|
91 | 38 | if (isset($reducao['reducao'])) { |
|
92 | 2 | $this->setReducao($reducao['reducao']); |
|
93 | 2 | } else { |
|
94 | 38 | $this->setReducao(null); |
|
95 | } |
||
96 | 38 | return $this; |
|
97 | } |
||
98 | |||
99 | 16 | public function getNode($name = null) |
|
106 | |||
107 | 7 | public function loadNode($element, $name = null) |
|
108 | { |
||
109 | 7 | $name = is_null($name)?'ICMS20':$name; |
|
120 | } |
||
121 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.