Test Failed
Push — master ( ac9ff0...806846 )
by Johan
03:01
created

PokerSquares::game()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 4

Importance

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