Passed
Push — master ( c89a06...397e48 )
by Alexander
02:30
created

ChangelogCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 9
dl 0
loc 23
ccs 0
cts 10
cp 0
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 1
A configure() 0 7 1
1
<?php
2
/**
3
 * This file is part of the SVN-Buddy library.
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 *
7
 * @copyright Alexander Obuhovich <[email protected]>
8
 * @link      https://github.com/console-helpers/svn-buddy
9
 */
10
11
namespace ConsoleHelpers\SVNBuddy\Command;
12
13
14
use Fiasco\SymfonyConsoleStyleMarkdown\Renderer;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
final class ChangelogCommand extends AbstractCommand
19
{
20
21
	/**
22
	 * {@inheritdoc}
23
	 */
24
	protected function configure()
25
	{
26
		$this
27
			->setName('changelog')
28
			->setDescription('Displays changes included in the current SVN-Buddy release');
29
30
		parent::configure();
31
	}
32
33
	protected function execute(InputInterface $input, OutputInterface $output)
34
	{
35
		$root_path = \dirname(__DIR__) . '/../..';
36
		$raw_changelog = \file_get_contents($root_path . '/CHANGELOG.md');
37
38
		$markdown_renderer = Renderer::createFromMarkdown($raw_changelog);
39
40
		$this->io->writeln((string)$markdown_renderer);
41
	}
42
43
}
44