PokerSquares::game()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 9.1992

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 5
cts 16
cp 0.3125
rs 9.568
c 0
b 0
f 0
cc 4
nc 8
nop 0
crap 9.1992
1
<?php
2
3
declare(strict_types=1);
4
5
// Folder \Controllers containing classes
6
namespace Joki20\Http\Controllers;
7
8
use Joki20\Http\Controllers\Scoring;
9
use Joki20\Http\Controllers\Setup;
10
11
/**
12
 * Class PokerSquares.
13
 */
14
15
class PokerSquares extends Scoring
16
{
17 1
    public function game() // new game
18
    {
19
        // SET NAME
20 1
        empty($_POST) ? print_r($this->name()) : null;
21
        // SET NAME RESULT
22 1
        if (isset($_POST['setName'])) {
23
            $this->prepareSessions(); // save name and reset points
24
            $this->shuffleDeck(); // shuffle deck, store in session('deck');
25
            $this->prepareStack(); // create draw stack
26
            print_r($this->displayGrid()); // setup grid
27
        }
28
        // // IF CARD WAS PLACED ($_POST begins with 'place')
29 1
        if (isset($_POST['placeCard'])) {
30
            $this->placeCard();
31
            $this->prepareStack();
32
            $this->setPointsSessions();
33
            $this->checkFullRow();
34
            $this->checkFullColumn();
35
            print_r($this->displayGrid());
36
            $this->storeToDatabase();
37
        }
38 1
    }
39
}
40