Completed
Push — master ( d5767c...12e29d )
by Michał
01:17
created

MasterProcess::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Phppm\Console;
4
5
use Phppm\ProcessManager;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Symfony\Component\Console\Input\InputArgument;
10
use Symfony\Component\Console\Style\SymfonyStyle;
11
12
class MasterProcess extends Command
13
{
14
    const DEFAULT_TIME = 50;
15
16
    protected function configure()
17
    {
18
        $this->setName('master process')
19
            ->setDescription('Monitoring process for all sub processes.')
20
            ->setHelp('');
21
22
        $this->addOption('interval', 'i', InputArgument::OPTIONAL, 'Master process monitoring interval time.');
23
    }
24
25
    /**
26
     * @param InputInterface $input
27
     * @param OutputInterface $output
28
     * @throws \InvalidArgumentException
29
     */
30
    protected function execute(InputInterface $input, OutputInterface $output)
31
    {
32
        $style = new SymfonyStyle($input, $output);
0 ignored issues
show
Unused Code introduced by
$style is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
33
34
//        $style->title('Script demonizer.');
35
        //http://php.net/manual/en/function.uniqid.php
36
        //http://php.net/manual/en/function.ignore-user-abort.php - for lunch master process in back
37
38
        $time = $input->getOption('interval') ?: self::DEFAULT_TIME;
39
40
//        $style->comment('Execute with interval: ' . $time);
41
42
43
        $processManager = new ProcessManager();
44
        $processManager->addWorker('\\', $output, $time);
45
    }
46
}
47