Nextrek
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
<?php namespace Illuminate\Foundation\Console;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
class ChangesCommand extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'changes';
/**
* The console command description.
*
* @var string
*/
protected $description = "Display the framework change list";
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
list($version, $changes) = $this->getChangeVersion($this->getChangesArray());
$this->writeHeader($version);
foreach ($changes as $change)
{
$this->line($this->formatMessage($change));
}
}
/**
* Write the heading for the change log.
*
* @param string $version
* @return void
*/
protected function writeHeader($version)
{
$this->info($heading = 'Changes For Laravel '.$version);
$this->comment(str_repeat('-', strlen($heading)));
}
/**
* Format the given change message.
*
* @param array $change
* @return string
*/
protected function formatMessage(array $change)
{
$message = '<comment>-></comment> <info>'.$change['message'].'</info>';
if ( ! is_null($change['backport']))
{
$message .= ' <comment>(Backported to '.$change['backport'].')</comment>';
}
return $message;
}
/**
* Get the change list for the specified version.
*
* @param array $changes
* @return array
*/
protected function getChangeVersion(array $changes)
{
$version = $this->argument('version');
if (is_null($version))
{
$latest = head(array_keys($changes));
return array($latest, $changes[$latest]);
}
return array($version, array_get($changes, $version, array()));
}
/**
* Get the changes array from disk.
*
* @return array
*/
protected function getChangesArray()
{
return json_decode(file_get_contents(__DIR__.'/../changes.json'), true);
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array(
array('version', InputArgument::OPTIONAL, 'The version to list changes for.'),
);
}
}
|
Revision |
Author |
Commited |
Message |
1464
|
MOliva
|
Tue 13 Oct, 2020 11:16:56 +0000 |
|