Skip to content

Commit 45ba8bd

Browse files
committed
move constants out of methods
1 parent 92866c2 commit 45ba8bd

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/Console/Command/ReleaseCommand.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@
2323
*/
2424
final class ReleaseCommand extends AbstractCommand
2525
{
26+
protected static $labels = array(
27+
'patch' => 'blue',
28+
'bug' => 'red',
29+
'docs' => 'yellow',
30+
'minor' => 'green',
31+
'pedantic' => 'cyan',
32+
);
33+
34+
protected static $stabilities = array(
35+
'patch' => 'blue',
36+
'minor' => 'green',
37+
'stable' => 'yellow',
38+
);
39+
2640
/**
2741
* {@inheritdoc}
2842
*/
@@ -122,26 +136,13 @@ private function prepareRelease(Package $package, $branch, OutputInterface $outp
122136

123137
private function printPullRequest($pull, OutputInterface $output)
124138
{
125-
$labelColors = array(
126-
'patch' => 'blue',
127-
'bug' => 'red',
128-
'docs' => 'yellow',
129-
'minor' => 'green',
130-
'pedantic' => 'cyan',
131-
);
132-
$stabilityColors = array(
133-
'patch' => 'blue',
134-
'minor' => 'green',
135-
'stable' => 'yellow',
136-
);
137-
138-
$output->write('<fg=black;bg='.$stabilityColors[$pull['stability']].'>['
139+
$output->write('<fg=black;bg='.static::$stabilities[$pull['stability']].'>['
139140
.strtoupper($pull['stability']).']</> <info>'.$pull['title'].'</info>');
140141
foreach ($pull['labels'] as $label) {
141-
if (!array_key_exists($label['name'], $labelColors)) {
142+
if (!array_key_exists($label['name'], static::$labels)) {
142143
$output->write(' <error>['.$label['name'].']</error>');
143144
} else {
144-
$output->write(' <fg='.$labelColors[$label['name']].'>['.$label['name'].']</>');
145+
$output->write(' <fg='.static::$labels[$label['name']].'>['.$label['name'].']</>');
145146
}
146147
}
147148

0 commit comments

Comments
 (0)