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

ChangelogCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 7
ccs 0
cts 4
cp 0
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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