PokerSquares   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 31.25%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 25
ccs 5
cts 16
cp 0.3125
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A game() 0 22 4
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