ExecuteCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 2
1
<?php
2
/**
3
 * For the full copyright and license information, please view the LICENSE.md
4
 * file that was distributed with this source code.
5
 */
6
7
namespace Notamedia\ConsoleJedi\Agent\Command;
8
9
use Notamedia\ConsoleJedi\Application\Command\BitrixCommand;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
/**
14
 * Execution of tasks from agents queue.
15
 *
16
 * @author Nik Samokhvalov <[email protected]>
17
 */
18
class ExecuteCommand extends BitrixCommand
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    protected function configure()
24
    {
25
        parent::configure();
26
27
        $this->setName('agent:execute')
28
            ->setDescription('Execution of tasks from agents queue');
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        @set_time_limit(0);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
37
        @ignore_user_abort(true);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
38
        define('CHK_EVENT', true);
39
40
        $agentManager = new \CAgent();
41
        $agentManager->CheckAgents();
42
43
        define('BX_CRONTAB_SUPPORT', true);
44
        define('BX_CRONTAB', true);
45
46
        $eventManager = new \CEvent();
47
        $eventManager->CheckEvents();
48
    }
49
}
50