Skip to content

Commit 55348f7

Browse files
Git icon color change automatically depending on the kernel version
1 parent cda7419 commit 55348f7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

DataCollector/GitDataCollector.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,31 @@ public function getName()
300300

301301
}
302302

303+
/**
304+
* change the icon color depending on the kernel version
305+
*
306+
* #3f3f3f < 2.8
307+
* #AAAAAA >= 2.8
308+
*
309+
* @return string
310+
*/
311+
public final function getIconColor()
312+
{
313+
if ((float)$this->getSymfonyVersion() >= 2.8) {
314+
return $this->data['iconColor'] = '#AAAAAA';
315+
}
316+
return $this->data['iconColor'] = '#3F3F3F';#3F3F3F
317+
}
318+
319+
/**
320+
* @return string
321+
*/
322+
private function getSymfonyVersion()
323+
{
324+
$symfonyVersion = \Symfony\Component\HttpKernel\Kernel::VERSION;
325+
$symfonyVersion = explode('.', $symfonyVersion, -1);
326+
$symfonyMajorMinorVersion = implode('.', $symfonyVersion);
327+
return $symfonyMajorMinorVersion;
328+
}
329+
303330
}

0 commit comments

Comments
 (0)