Frame   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A addRows() 0 4 2
A newLine() 0 4 2
A getRows() 0 3 1
A count() 0 3 1
A addRow() 0 3 1
1
<?php
2
3
namespace PhpSchool\CliMenu;
4
5
/**
6
 * Represents the current screen being displayed
7
 * contains all rows of output
8
 *
9
 * @author Aydin Hassan <[email protected]>
10
 */
11
class Frame implements \Countable
12
{
13
    /**
14
     * @var array
15
     */
16
    private $rows = [];
17
18
    public function newLine(int $count = 1) : void
19
    {
20
        foreach (range(1, $count) as $i) {
21
            $this->rows[] = "\n";
22
        }
23
    }
24
25
    public function addRows(array $rows = []) : void
26
    {
27
        foreach ($rows as $row) {
28
            $this->rows[] = $row;
29
        }
30
    }
31
32
    public function addRow(string $row) : void
33
    {
34
        $this->rows[] = $row;
35
    }
36
37
    public function count() : int
38
    {
39
        return count($this->rows);
40
    }
41
42
    public function getRows() : array
43
    {
44
        return $this->rows;
45
    }
46
}
47