1 | <?php |
||
17 | class GitDataCollector extends DataCollector |
||
18 | { |
||
19 | private $gitService; |
||
20 | |||
21 | /** |
||
22 | * @param $repositoryCommitUrl |
||
23 | */ |
||
24 | public function __construct(ContainerInterface $container) |
||
30 | |||
31 | /** |
||
32 | * Collect Git data for DebugBar (branch,commit,author,email,merge,date,message) |
||
33 | * |
||
34 | * @param Request $request |
||
35 | * @param Response $response |
||
36 | * @param \Exception $exception |
||
37 | */ |
||
38 | public function collect(Request $request, Response $response, \Exception $exception = null) |
||
56 | |||
57 | /** |
||
58 | * true if there is some data : used by the view |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | public function getGitData() |
||
66 | |||
67 | /** |
||
68 | * Actual branch name |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | public function getBranch() |
||
76 | |||
77 | /** |
||
78 | * Commit ID |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function getCommit() |
||
86 | |||
87 | /** |
||
88 | * Merge information |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | public function getMerge() |
||
96 | |||
97 | /** |
||
98 | * Merge information |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getGitDIr() |
||
106 | |||
107 | /** |
||
108 | * Author |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getAuthor() |
||
116 | |||
117 | /** |
||
118 | * Author's email |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function getEmail() |
||
126 | |||
127 | /** |
||
128 | * Commit date |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | public function getDate() |
||
136 | |||
137 | /** |
||
138 | * Minutes since last commit |
||
139 | * |
||
140 | * @return string |
||
141 | */ |
||
142 | public function getTimeCommitIntervalMinutes() |
||
146 | |||
147 | /** |
||
148 | * Seconds since latest commit |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | public function getTimeCommitIntervalSeconds() |
||
156 | |||
157 | /** |
||
158 | * Commit message |
||
159 | * |
||
160 | * @return string |
||
161 | */ |
||
162 | public function getMessage() |
||
166 | |||
167 | /** |
||
168 | * Commit URL |
||
169 | * |
||
170 | * @return string |
||
171 | */ |
||
172 | public function getCommitUrl() |
||
176 | |||
177 | /** |
||
178 | * Checks and returns the data |
||
179 | * |
||
180 | * @param string $data |
||
181 | * @return string |
||
182 | */ |
||
183 | private function getData($data) |
||
187 | |||
188 | /** |
||
189 | * DataCollector name : used by service declaration into container.yml |
||
190 | * |
||
191 | * @return string |
||
192 | */ |
||
193 | public function getName() |
||
197 | |||
198 | /** |
||
199 | * Change icons color according to the version of symfony |
||
200 | * |
||
201 | * #3f3f3f < 2.8 |
||
202 | * #AAAAAA >= 2.8 |
||
203 | * |
||
204 | * @return string |
||
205 | */ |
||
206 | public final function getIconColor() |
||
214 | |||
215 | /** |
||
216 | * @return string |
||
217 | */ |
||
218 | private function getSymfonyVersion() |
||
226 | |||
227 | private function verifyExistMergeInCommit() |
||
235 | |||
236 | private function getDateCommit() |
||
252 | } |
||
253 | |||
254 |