Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | public function setWeight($weight) |
||
26 | { |
||
27 | if (is_numeric($weight)) { |
||
28 | $weightObject = new Weight(); |
||
29 | $weightObject->setWeight($weight); |
||
30 | $weight = $weightObject; |
||
31 | } else { |
||
32 | if (!($weight instanceOf Weight)) { |
||
33 | throw new \Exception('Weight must either be numeric or an instance of \SimpleUPS\Weight'); |
||
34 | } |
||
35 | } |
||
36 | |||
37 | $this->weight = $weight; |
||
38 | return $this; |
||
39 | } |
||
40 | |||
49 | } |