PrintRequestUrlCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 3
Bugs 3 Features 0
Metric Value
eloc 8
dl 0
loc 28
rs 10
c 3
b 3
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A configure() 0 4 1
A execute() 0 5 1
1
<?php declare(strict_types = 1);
2
3
namespace Portiny\Console\Tests\Source;
4
5
use Nette\Http\IRequest;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
final class PrintRequestUrlCommand extends Command
11
{
12
	/**
13
	 * @var IRequest
14
	 */
15
	private $request;
16
17
18
	public function __construct(IRequest $request)
19
	{
20
		parent::__construct();
21
22
		$this->request = $request;
23
	}
24
25
26
	protected function configure(): void
27
	{
28
		$this->setName('print-request-url')
29
			->setDescription('Print request URL');
30
	}
31
32
33
	protected function execute(InputInterface $input, OutputInterface $output): ?int
34
	{
35
		$output->write($this->request->getUrl()->getAbsoluteUrl());
36
37
		return 0;
38
	}
39
40
}
41