This repository was archived by the owner on Apr 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathcellitem.php
More file actions
71 lines (49 loc) · 1.29 KB
/
Copy pathcellitem.php
File metadata and controls
71 lines (49 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
namespace GoogleSpreadsheet;
class CellItem {
private $cellRow;
private $cellColumn;
private $cellVersion;
private $cellReference;
private $value;
private $valueInitial;
public function __construct($URL,$cellReference,$value) {
// extract key data from cell URL
if (!preg_match(
'/\/private\/full\/R(?P<row>[0-9]+)C(?P<column>[0-9]+)\/(?P<version>[a-z0-9]+)$/',
$URL,$matchList
)) {
// invalid Google spreadsheet cell URL format
throw new \Exception('Invalid spreadsheet cell item URL format');
return;
}
// save data items from URL
$this->cellRow = $matchList['row'];
$this->cellColumn = $matchList['column'];
$this->cellVersion = $matchList['version'];
// save cell reference (e.g. 'B1') and current cell value
$this->cellReference = $cellReference;
$this->valueInitial = $this->value = $value;
}
public function getRow() {
return $this->cellRow;
}
public function getColumn() {
return $this->cellColumn;
}
public function getVersion() {
return $this->cellVersion;
}
public function getReference() {
return $this->cellReference;
}
public function getValue() {
return $this->value;
}
public function setValue($value) {
$this->value = $value;
}
public function isDirty() {
return ($this->value !== $this->valueInitial);
}
}