Issues (17)

src/Card/Game.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App\Card;
4
5
use Symfony\Component\HttpFoundation\Session\SessionInterface;
6
use App\Card\DeckOfCards;
7
use App\Card\Turn;
8
9
class Game
10
{
11
    private $session;
12 9
13
    public function __construct(SessionInterface $session)
14 9
    {
15
        $this->session = $session;
16 3
    }
17
18
    public function playGame(DeckOfCards $deck, SessionInterface $session, Turn $turn, bool $drawCard, bool $stop): bool
19
    {
20 3
        if ($drawCard) {
21 1
            $turn->playerTurn($deck);
22
        }
23
24 3
        if ($stop) {
25 1
            $turn->bankTurn($deck);
26
        }
27
28 3
        $gameOver = true;
29 3
        $this->resetGame($session);
0 ignored issues
show
The method resetGame() does not exist on App\Card\Game. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
        $this->/** @scrutinizer ignore-call */ 
30
               resetGame($session);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
31 3
        return $gameOver;
32
    }
33
34 1
    public function winner(int $playerScore, int $bankScore): string
35
    {
36 1
        if ($playerScore > 21) {
37 1
            return "Bank wins";
38
        }
39
40 1
        if ($bankScore > 21) {
41 1
            return "Player wins";
42
        }
43
44 1
        if ($bankScore >= $playerScore) {
45 1
            return "Bank wins";
46
        }
47 1
        return "Player wins";
48
    }
49
}
50