Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function onTransactionPaid(TransactionModel $transaction) |
||
29 | { |
||
30 | /** @var TransactionItemModel $item */ |
||
31 | foreach ($transaction->getItems() as $item) { |
||
32 | $entity = $item->getEntity(); |
||
33 | $qty = $item->qty; |
||
34 | |||
35 | if ($entity instanceof ProductModel) { |
||
36 | $entity->stock = $entity->stock - $qty; |
||
37 | $entity->save(); |
||
38 | } |
||
39 | } |
||
40 | } |
||
41 | |||
47 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.