| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 47 | 18 | public function beginTransaction() |
|
| 48 | { |
||
| 49 | 18 | if ($this->running) { |
|
| 50 | 3 | throw new BeginException('Transaction already running'); |
|
| 51 | } |
||
| 52 | |||
| 53 | 18 | if (count($this->items) === 0) { |
|
| 54 | 3 | throw new BeginException('No transaction to start'); |
|
| 55 | } |
||
| 56 | |||
| 57 | 15 | foreach ($this->items as $item) { |
|
| 58 | 15 | $item->beginTransaction(); |
|
| 59 | 10 | } |
|
| 60 | |||
| 61 | 15 | $this->running = true; |
|
|
|
|||
| 62 | 15 | } |
|
| 63 | |||
| 112 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.