Passed
Push — master ( 7e03c5...6dfa53 )
by Dev
34:30 queued 19:18
created

PageRankCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 26
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 9 1
A execute() 0 7 1
1
<?php
2
3
namespace PiedWeb\SeoPocketCrawler\Command;
4
5
use PiedWeb\SeoPocketCrawler\SimplePageRankCalculator;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class PageRankCommand extends Command
12
{
13
    protected static $defaultName = 'crawler:pagerank';
14
15
    protected $id;
16
17
    protected function configure()
18
    {
19
        $this->setDescription('Add internal page rank to index.csv');
20
21
        $this
22
            ->addArgument(
23
                'id',
24
                InputArgument::REQUIRED,
25
                'id from a previous crawl'
26
            )
27
        ;
28
    }
29
30
    protected function execute(InputInterface $input, OutputInterface $output)
31
    {
32
        $pr = new SimplePageRankCalculator($input->getArgument('id'));
0 ignored issues
show
Bug introduced by
It seems like $input->getArgument('id') can also be of type null and string[]; however, parameter $id of PiedWeb\SeoPocketCrawler...lculator::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

32
        $pr = new SimplePageRankCalculator(/** @scrutinizer ignore-type */ $input->getArgument('id'));
Loading history...
33
34
        echo $pr->record().PHP_EOL;
35
36
        return 0;
37
    }
38
}
39