Completed
Push — master ( c7bdb1...5472d7 )
by Aydin
04:34
created

Frame::addRow()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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
    /**
19
     * @param int $count
20
     */
21
    public function newLine($count = 1)
22
    {
23
        foreach (range(1, $count) as $i) {
24
            $this->rows[] = "\n";
25
        }
26
    }
27
28
    /**
29
     * @param array $rows
30
     */
31
    public function addRows(array $rows = [])
32
    {
33
        foreach ($rows as $row) {
34
            $this->rows[] = $row;
35
        }
36
    }
37
38
    /**
39
     * @param string $row
40
     */
41
    public function addRow($row)
42
    {
43
        $this->rows[] = $row;
44
    }
45
46
    /**
47
     * @return int
48
     */
49
    public function count()
50
    {
51
        return count($this->rows);
52
    }
53
54
    /**
55
     * @return array
56
     */
57
    public function getRows()
58
    {
59
        return $this->rows;
60
    }
61
}
62