We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 5 |
| Paths | 6 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 49 | private function updateValue() : void { |
||
| 50 | $numAces11 = 0; // Aces have a value of 11 by default |
||
| 51 | $value = 0; |
||
| 52 | foreach ($this->cards as $card) { |
||
| 53 | if ($card->isAce()) { |
||
| 54 | $numAces11 += 1; |
||
| 55 | } |
||
| 56 | $value += $card->getValue(); |
||
| 57 | } |
||
| 58 | // Modify value of aces if we're over 21 |
||
| 59 | while ($value > 21 && $numAces11 > 0) { |
||
| 60 | $value -= 10; |
||
| 61 | $numAces11 -= 1; |
||
| 62 | } |
||
| 63 | $this->value = $value; |
||
| 64 | } |
||
| 67 |