Completed
Push — master ( aca6e3...e7aa24 )
by Vladimir
05:21
created

Nagius   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 29.4%

Importance

Changes 0
Metric Value
wmc 6
eloc 18
dl 0
loc 41
c 0
b 0
f 0
ccs 5
cts 17
cp 0.294
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A onAfterRun() 0 20 4
A __construct() 0 6 2
1
<?php
2
3
/**
4
 * This file is part of the `tvi/monitor-bundle` project.
5
 *
6
 * (c) https://github.com/turnaev/monitor-bundle/graphs/contributors
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
11
12
namespace Tvi\MonitorBundle\Reporter;
13
14
use Symfony\Component\Console\Output\ConsoleOutput;
15
use Symfony\Component\Console\Output\OutputInterface;
16
use ZendDiagnostics\Check\CheckInterface;
17
use ZendDiagnostics\Result\ResultInterface;
18
use ZendDiagnostics\Result\SkipInterface;
19
use ZendDiagnostics\Result\SuccessInterface;
20
use ZendDiagnostics\Result\WarningInterface;
21
22
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
23
 * @author Kevin Bond <[email protected]>, Vladimir Turnaev <[email protected]>
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
24
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
25
class Nagius extends ReporterAbstract
26
{
27
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
28
     * @var OutputInterface
29
     */
30
    protected $output;
31
32
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
33
     * @param OutputInterface $output
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
34
     */
35 3
    public function __construct(OutputInterface $output = null)
36
    {
37 3
        if (null === $output) {
38 3
            $output = new ConsoleOutput();
39
        }
40 3
        $this->output = $output;
41 3
    }
42
43
    /**
0 ignored issues
show
Coding Style introduced by
Parameter $check should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $result should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $checkAlias should have a doc-comment as per coding-style.
Loading history...
44
     * {@inheritdoc}
45
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
46
    public function onAfterRun(CheckInterface $check, ResultInterface $result, $checkAlias = null)
47
    {
48
        switch (true) {
49
            case $result instanceof SuccessInterface:
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 8 spaces, found 12
Loading history...
50
                $statusOut = 'OK';
51
                break;
52
53
            case $result instanceof WarningInterface:
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 8 spaces, found 12
Loading history...
54
                $statusOut = 'WARNING';
55
                break;
56
57
            case $result instanceof SkipInterface:
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 8 spaces, found 12
Loading history...
58
                $statusOut = 'SKIP';
59
                break;
60
61
            default:
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 8 spaces, found 12
Loading history...
62
                $statusOut = 'FAIL';
63
        }
64
65
        $this->output->writeln(sprintf('%-8s %-25s %s', $statusOut, $check->getId(), $check->getLabel()));
0 ignored issues
show
Bug introduced by
The method getId() does not exist on ZendDiagnostics\Check\CheckInterface. It seems like you code against a sub-type of ZendDiagnostics\Check\CheckInterface such as Tvi\MonitorBundle\Check\CheckInterface or Tvi\MonitorBundle\Check\fs\DiskUsage\Check or Tvi\MonitorBundle\Check\php\PhpFlag\Check or Tvi\MonitorBundle\Check\fs\DirWritable\Check or Tvi\MonitorBundle\Check\php\ApcMemory\Check or Tvi\MonitorBundle\Check\php\OpCacheMemory\Check or Tvi\MonitorBundle\Check\php\ClassExists\Check or Tvi\MonitorBundle\Check\sys\CpuPerformance\Check or Tvi\MonitorBundle\Check\db\PDOCheck\Check or Tvi\MonitorBundle\Check\fs\DirReadable\Check or Tvi\MonitorBundle\Check\fs\DiskFree\Check or Tvi\MonitorBundle\Check\...xtensionNotLoaded\Check or Tvi\MonitorBundle\Check\php\ExtensionLoaded\Check or Tvi\MonitorBundle\Check\php\ApcFragmentation\Check or Tvi\MonitorBundle\Check\php\PhpVersion\Check or Tvi\MonitorBundle\Check\...reamWrapperExists\Check or Tvi\MonitorBundle\Test\Check\TestCheck\Check or Tvi\MonitorBundle\Check\php\Expression\Check or Tvi\MonitorBundle\Check\fs\IniFile\Check or Tvi\MonitorBundle\Check\fs\XmlFile\Check or Tvi\MonitorBundle\Check\fs\YamlFile\Check or Tvi\MonitorBundle\Check\fs\JsonFile\Check or Tvi\MonitorBundle\Check\fs\DiskUsage\Check or Tvi\MonitorBundle\Check\php\PhpFlag\Check or Tvi\MonitorBundle\Check\fs\DirWritable\Check or Tvi\MonitorBundle\Check\php\ApcMemory\Check or Tvi\MonitorBundle\Check\php\OpCacheMemory\Check or Tvi\MonitorBundle\Check\php\ClassExists\Check or Tvi\MonitorBundle\Check\redis\Redis\Check or Tvi\MonitorBundle\Check\php\SecurityAdvisory\Check or Tvi\MonitorBundle\Check\sys\CpuPerformance\Check or Tvi\MonitorBundle\Check\sys\ProcessRunning\Check or Tvi\MonitorBundle\Check\fs\DirReadable\Check or Tvi\MonitorBundle\Check\mongo\Mongo\Check or Tvi\MonitorBundle\Check\fs\DiskFree\Check or Tvi\MonitorBundle\Check\memcache\Memcached\Check or Tvi\MonitorBundle\Check\...xtensionNotLoaded\Check or Tvi\MonitorBundle\Check\php\ExtensionLoaded\Check or Tvi\MonitorBundle\Check\php\ApcFragmentation\Check or Tvi\MonitorBundle\Check\php\PhpVersion\Check or Tvi\MonitorBundle\Check\memcache\Memcache\Check or Tvi\MonitorBundle\Check\http\HttpService\Check or Tvi\MonitorBundle\Check\...GuzzleHttpService\Check or Tvi\MonitorBundle\Check\...reamWrapperExists\Check or Tvi\MonitorBundle\Check\rabbitmq\RabbitMQ\Check. ( Ignorable by Annotation )

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

65
        $this->output->writeln(sprintf('%-8s %-25s %s', $statusOut, $check->/** @scrutinizer ignore-call */ getId(), $check->getLabel()));
Loading history...
66
    }
67
}
68