Skip to content

Commit 06e8265

Browse files
author
Kendrick
committed
scrutinizer ci
1 parent 1cd5437 commit 06e8265

File tree

4 files changed

+38
-37
lines changed

4 files changed

+38
-37
lines changed

DataCollector/GitDataCollector.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function collect(Request $request, Response $response, \Exception $except
5454
// get latest commit information
5555
exec("git log -1", $data);
5656

57-
if (isset($data) && $data) {
57+
if (isset($data) && !empty($data)) {
5858

5959
// there is some information
6060
$this->data['gitData'] = true;
@@ -73,14 +73,16 @@ public function collect(Request $request, Response $response, \Exception $except
7373

7474
preg_match('$Author: ([^<]+)<(.+)>$', $d, $author);
7575

76-
if (isset($author[1])) $this->data['author'] = trim($author[1]);
77-
if (isset($author[2])) $this->data['email'] = $author[2];
76+
if (isset($author[1])) {
77+
$this->data['author'] = trim($author[1]);
78+
}
79+
if (isset($author[2])) {
80+
$this->data['email'] = $author[2];
81+
}
7882

7983
} elseif (strpos($d, 'Date') === 0) {
8084

81-
// date, ex : Fri Mar 6 16:56:25 2015 +0100
82-
83-
$date = trim(substr($d, 5));
85+
$date = trim(substr($d, 5)); // Fri Mar 6 16:56:25 2015 +0100
8486

8587
// date of commit
8688
$dateCommit = date_create($date);
@@ -90,7 +92,7 @@ public function collect(Request $request, Response $response, \Exception $except
9092
$dateNow = date_create($dateRuntime->format('Y-m-d H:i:s'));
9193

9294
// difference
93-
$time = date_diff($dateCommit,$dateNow);
95+
$time = date_diff($dateCommit, $dateNow);
9496

9597
// static time difference : minutes and seconds
9698
$this->data['timeCommitIntervalMinutes'] = $time->format('%y')*365*24*60+$time->format('%m')*30*24*60+$time->format('%d')*24*60+$time->format('%h')*60+$time->format('%i');
@@ -125,13 +127,12 @@ public function collect(Request $request, Response $response, \Exception $except
125127

126128
// branch name
127129

128-
$this->data['branch'] = trim(substr($data[0], strpos($data[0],'On branch')+9));
130+
$this->data['branch'] = trim(substr($data[0], strpos($data[0], 'On branch')+9));
129131

130132
}
131133
}
132134

133-
}
134-
else {
135+
} else {
135136

136137
// no git data
137138

@@ -277,7 +278,7 @@ public function getCommitUrl()
277278
/**
278279
* Checks and returns the data
279280
*
280-
* @param $data
281+
* @param string $data
281282
* @return string
282283
*/
283284
private function getData($data)

DependencyInjection/Configuration.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
*/
1212
class Configuration implements ConfigurationInterface
1313
{
14-
/**
15-
* {@inheritdoc}
16-
*/
17-
public function getConfigTreeBuilder()
18-
{
19-
$treeBuilder = new TreeBuilder();
20-
$rootNode = $treeBuilder->root('symfony_debug_toolbar_git');
14+
/**
15+
* {@inheritdoc}
16+
*/
17+
public function getConfigTreeBuilder()
18+
{
19+
$treeBuilder = new TreeBuilder();
20+
$rootNode = $treeBuilder->root('symfony_debug_toolbar_git');
2121

22-
$rootNode
23-
->children()
24-
->scalarNode('repository_commit_url')
25-
->end()
26-
;
22+
$rootNode
23+
->children()
24+
->scalarNode('repository_commit_url')
25+
->end()
26+
;
2727

28-
return $treeBuilder;
29-
}
28+
return $treeBuilder;
29+
}
3030
}

DependencyInjection/SymfonyDebugToolbarGitExtension.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
*/
1414
class SymfonyDebugToolbarGitExtension extends Extension
1515
{
16-
/**
17-
* {@inheritdoc}
18-
*/
19-
public function load(array $configs, ContainerBuilder $container)
20-
{
21-
$configuration = new Configuration();
22-
$config = $this->processConfiguration($configuration, $configs);
16+
/**
17+
* {@inheritdoc}
18+
*/
19+
public function load(array $configs, ContainerBuilder $container)
20+
{
21+
$configuration = new Configuration();
22+
$config = $this->processConfiguration($configuration, $configs);
2323

24-
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
25-
$loader->load('container.yml');
24+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
25+
$loader->load('container.yml');
2626

27-
$container->setParameter('symfony_debug_toolbar_git.repository_commit_url', $config['repository_commit_url']);
28-
}
27+
$container->setParameter('symfony_debug_toolbar_git.repository_commit_url', $config['repository_commit_url']);
28+
}
2929
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Symfony Debug Toolbar Git
77

88
[![Monthly Downloads](https://poser.pugx.org/kendrick/symfony-debug-toolbar-git/d/monthly.png)](https://packagist.org/packages/kendrick/symfony-debug-toolbar-git) [![Daily Downloads](https://poser.pugx.org/kendrick/symfony-debug-toolbar-git/d/daily.png)](https://packagist.org/packages/kendrick/symfony-debug-toolbar-git)
99

10-
[![travis CI](https://travis-ci.org/kendrick-k/symfony-debug-toolbar-git.svg?branch=develop)](https://travis-ci.org/kendrick-k/symfony-debug-toolbar-git)
10+
[![Travis CI](https://travis-ci.org/kendrick-k/symfony-debug-toolbar-git.svg?branch=develop)](https://travis-ci.org/kendrick-k/symfony-debug-toolbar-git) [![Scrutinizer CI](https://scrutinizer-ci.com/g/kendrick-k/symfony-debug-toolbar-git/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/kendrick-k/symfony-debug-toolbar-git/) [![Scrutinizer CI](https://scrutinizer-ci.com/g/kendrick-k/symfony-debug-toolbar-git/badges/build.png?b=master)](https://scrutinizer-ci.com/g/kendrick-k/symfony-debug-toolbar-git/)
1111

1212
## Symfony toolbar add-on
1313

0 commit comments

Comments
 (0)