Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/diffusion/data/DiffusionRepositoryPath.php
12241 views
1
<?php
2
3
final class DiffusionRepositoryPath extends Phobject {
4
5
private $fullPath;
6
private $path;
7
private $hash;
8
private $fileType;
9
private $fileSize;
10
private $externalURI;
11
12
private $lastModifiedCommit;
13
private $lastCommitData;
14
15
public function setFullPath($full_path) {
16
$this->fullPath = $full_path;
17
return $this;
18
}
19
20
public function getFullPath() {
21
return $this->fullPath;
22
}
23
24
public function setPath($path) {
25
$this->path = $path;
26
return $this;
27
}
28
29
public function getPath() {
30
return $this->path;
31
}
32
33
public function setHash($hash) {
34
$this->hash = $hash;
35
return $this;
36
}
37
38
public function getHash() {
39
return $this->hash;
40
}
41
42
public function setLastModifiedCommit(
43
PhabricatorRepositoryCommit $commit) {
44
$this->lastModifiedCommit = $commit;
45
return $this;
46
}
47
48
public function getLastModifiedCommit() {
49
return $this->lastModifiedCommit;
50
}
51
52
public function setLastCommitData(
53
PhabricatorRepositoryCommitData $last_commit_data) {
54
$this->lastCommitData = $last_commit_data;
55
return $this;
56
}
57
58
public function getLastCommitData() {
59
return $this->lastCommitData;
60
}
61
62
public function setFileType($file_type) {
63
$this->fileType = $file_type;
64
return $this;
65
}
66
67
public function getFileType() {
68
return $this->fileType;
69
}
70
71
public function setFileSize($file_size) {
72
$this->fileSize = $file_size;
73
return $this;
74
}
75
76
public function getFileSize() {
77
return $this->fileSize;
78
}
79
80
public function setExternalURI($external_uri) {
81
$this->externalURI = $external_uri;
82
return $this;
83
}
84
85
public function getExternalURI() {
86
return $this->externalURI;
87
}
88
89
public function toDictionary() {
90
$last_modified_commit = $this->getLastModifiedCommit();
91
if ($last_modified_commit) {
92
$last_modified_commit = $last_modified_commit->toDictionary();
93
}
94
$last_commit_data = $this->getLastCommitData();
95
if ($last_commit_data) {
96
$last_commit_data = $last_commit_data->toDictionary();
97
}
98
return array(
99
'fullPath' => $this->getFullPath(),
100
'path' => $this->getPath(),
101
'hash' => $this->getHash(),
102
'fileType' => $this->getFileType(),
103
'fileSize' => $this->getFileSize(),
104
'externalURI' => $this->getExternalURI(),
105
'lastModifiedCommit' => $last_modified_commit,
106
'lastCommitData' => $last_commit_data,
107
);
108
}
109
110
public static function newFromDictionary(array $dict) {
111
$path = id(new DiffusionRepositoryPath())
112
->setFullPath($dict['fullPath'])
113
->setPath($dict['path'])
114
->setHash($dict['hash'])
115
->setFileType($dict['fileType'])
116
->setFileSize($dict['fileSize'])
117
->setExternalURI($dict['externalURI']);
118
if ($dict['lastModifiedCommit']) {
119
$last_modified_commit = PhabricatorRepositoryCommit::newFromDictionary(
120
$dict['lastModifiedCommit']);
121
$path->setLastModifiedCommit($last_modified_commit);
122
}
123
if ($dict['lastCommitData']) {
124
$last_commit_data = PhabricatorRepositoryCommitData::newFromDictionary(
125
$dict['lastCommitData']);
126
$path->setLastCommitData($last_commit_data);
127
}
128
return $path;
129
}
130
}
131
132