| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function save(TransactionInterface $transaction = null, bool $queueRelations = true): int |
||
| 19 | { |
||
| 20 | //saturate transaction |
||
| 21 | $transaction->addCommand($command = $this->queueSave($queueRelations)); |
||
|
|
|||
| 22 | |||
| 23 | if ($command instanceof InsertCommand) { |
||
| 24 | return self::CREATED; |
||
| 25 | } elseif ($command instanceof UpdateCommand) { |
||
| 26 | return self::UPDATED; |
||
| 27 | } |
||
| 28 | |||
| 29 | return self::UNCHANGED; |
||
| 30 | } |
||
| 31 | |||
| 38 | } |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: