Completed
Branch master (80ac3a)
by kacper
04:34 queued 51s
created

TableMap::getTable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace MySQLReplication\Event\RowEvent;
4
5
/**
6
 * Class TableMap
7
 * @package MySQLReplication\Event\RowEvent
8
 */
9
class TableMap implements \JsonSerializable
10
{
11
    /**
12
     * @var string
13
     */
14
    private $database;
15
    /**
16
     * @var string
17
     */
18
    private $table;
19
    /**
20
     * @var int
21
     */
22
    private $tableId;
23
    /**
24
     * @var int
25
     */
26
    private $columnsAmount;
27
    /**
28
     * @var array
29
     */
30
    private $fields;
31
32
    /**
33
     * TableMap constructor.
34
     * @param string $database
35
     * @param string $table
36
     * @param int $tableId
37
     * @param int $columnsAmount
38
     * @param array $fields
39
     */
40 53
    public function __construct(
41
        $database,
42
        $table,
43
        $tableId,
44
        $columnsAmount,
45
        array $fields
46
    ) {
47 53
        $this->database = $database;
48 53
        $this->table = $table;
49 53
        $this->tableId = $tableId;
50 53
        $this->columnsAmount = $columnsAmount;
51 53
        $this->fields = $fields;
52 53
    }
53
54
    /**
55
     * @return string
56
     */
57 1
    public function getDatabase()
58
    {
59 1
        return $this->database;
60
    }
61
62
    /**
63
     * @return string
64
     */
65 2
    public function getTable()
66
    {
67 2
        return $this->table;
68
    }
69
70
    /**
71
     * @return int
72
     */
73 1
    public function getTableId()
74
    {
75 1
        return $this->tableId;
76
    }
77
78
    /**
79
     * @return int
80
     */
81 52
    public function getColumnsAmount()
82
    {
83 52
        return $this->columnsAmount;
84
    }
85
86
    /**
87
     * @return array
88
     */
89 53
    public function getFields()
90
    {
91 53
        return $this->fields;
92
    }
93
94
    /**
95
     * Specify data which should be serialized to JSON
96
     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
97
     * @return mixed data which can be serialized by <b>json_encode</b>,
98
     * which is a value of any type other than a resource.
99
     * @since 5.4.0
100
     */
101 1
    public function jsonSerialize()
102
    {
103 1
        return get_object_vars($this);
104
    }
105
}