PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 3.8.0
WP STAGING – WordPress Backup, Restore, Migration & Clone v3.8.0
4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Framework / Database / TableDto.php
wp-staging / Framework / Database Last commit date
QueryBuilder 2 years ago DbInfo.php 2 years ago ExcludedTables.php 4 years ago OptionPreservationHandler.php 2 years ago SearchReplace.php 2 years ago SelectedTables.php 2 years ago TableDto.php 5 years ago TableService.php 2 years ago TablesRenamer.php 2 years ago WpDbInfo.php 2 years ago WpOptionsInfo.php 2 years ago iDbInfo.php 2 years ago
TableDto.php
156 lines
1 <?php
2
3 // TODO PHP7.x; declare(strict_types=1);
4 // TODO PHP7.x; type-hints & return types
5
6 namespace WPStaging\Framework\Database;
7
8 use DateTime;
9 use WPStaging\Framework\Interfaces\HydrateableInterface;
10
11 class TableDto implements HydrateableInterface
12 {
13 /** @var string */
14 private $name;
15
16 /** @var int */
17 private $rows;
18
19 /** @var int */
20 private $size;
21
22 /** @var int */
23 private $autoIncrement;
24
25 /** @var DateTime */
26 private $createdAt;
27
28 /** @var DateTime */
29 private $updatedAt;
30
31 public function hydrate(array $data = [])
32 {
33 $this->setName($data['Name']);
34
35 $this->setRows(isset($data['Rows']) ? (int) $data['Rows'] : 0);
36 $this->setAutoIncrement(isset($data['Auto_increment']) ? $data['Auto_increment'] : null);
37 /** @noinspection PhpUnhandledExceptionInspection */
38 $this->setCreatedAt(new DateTime(isset($data['Create_time']) ? $data['Create_time'] : ''));
39 if (isset($data['Update_time']) && $data['Update_time']) {
40 /** @noinspection PhpUnhandledExceptionInspection */
41 $this->setUpdatedAt(new DateTime($data['Update_time']));
42 }
43
44 if (isset($data['Data_length'], $data['Index_length'])) {
45 $size = (int) $data['Data_length'] + (int) $data['Index_length'];
46 $this->setSize($size);
47 }
48
49 return $this;
50 }
51
52 /**
53 * @return string
54 */
55 public function getName()
56 {
57 return $this->name;
58 }
59
60 /**
61 * @param string $name
62 */
63 public function setName($name)
64 {
65 $this->name = $name;
66 }
67
68 /**
69 * @return int
70 */
71 public function getRows()
72 {
73 return $this->rows;
74 }
75
76 /**
77 * @param int $rows
78 */
79 public function setRows($rows)
80 {
81 $this->rows = $rows;
82 }
83
84 /**
85 * @return int
86 */
87 public function getSize()
88 {
89 return $this->size;
90 }
91
92 /**
93 * @param int $size
94 */
95 public function setSize($size)
96 {
97 $this->size = $size;
98 }
99
100 /**
101 * @return int|null
102 */
103 public function getAutoIncrement()
104 {
105 return $this->autoIncrement;
106 }
107
108 /**
109 * @param int|null $autoIncrement
110 */
111 public function setAutoIncrement($autoIncrement)
112 {
113 $this->autoIncrement = $autoIncrement;
114 }
115
116 /**
117 * @return DateTime
118 */
119 public function getCreatedAt()
120 {
121 return $this->createdAt;
122 }
123
124 /**
125 * @param DateTime $createdAt
126 */
127 public function setCreatedAt($createdAt)
128 {
129 $this->createdAt = $createdAt;
130 }
131
132 /**
133 * @return DateTime|null
134 */
135 public function getUpdatedAt()
136 {
137 return $this->updatedAt;
138 }
139
140 /**
141 * @param DateTime $updatedAt
142 */
143 public function setUpdatedAt($updatedAt)
144 {
145 $this->updatedAt = $updatedAt;
146 }
147
148 /**
149 * @return string
150 */
151 public function getHumanReadableSize()
152 {
153 return size_format($this->size);
154 }
155 }
156