| Conditions | 4 |
| Paths | 3 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function getQuantity() |
||
| 18 | { |
||
| 19 | if (!$this->isNewRecord && isset($this->type)) { |
||
|
|
|||
| 20 | /** @var QuantityFormatterFactoryInterface $factory */ |
||
| 21 | $factory = Yii::$container->get(QuantityFormatterFactoryInterface::class); |
||
| 22 | $billQty = $factory->create($this); |
||
| 23 | |||
| 24 | if ($billQty !== null) { |
||
| 25 | return $billQty->getClientValue(); |
||
| 26 | } |
||
| 27 | } |
||
| 28 | } |
||
| 29 | } |
||
| 30 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: