Completed
Pull Request — master (#29)
by
unknown
01:19
created

TestConnectionTask   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 12 2
1
<?php
2
3
namespace PhpTek\Sentry\Tasks;
4
5
use Monolog\Logger;
6
use Psr\Log\LoggerInterface;
7
use SilverStripe\Core\Injector\Injector;
8
use SilverStripe\Dev\BuildTask;
9
10
class TestConnectionTask extends BuildTask
11
{
12
    protected $title = 'Test Sentry Configuration';
13
14
    protected $description = 'Captures message for all levels available';
15
16
    /**
17
     * Implement this method in the task subclass to
18
     * execute via the TaskRunner
19
     *
20
     * @param \SilverStripe\Control\HTTPRequest|null $request
21
     */
22
    public function run($request = null)
23
    {
24
        /** @var LoggerInterface $logger */
25
        $logger = Injector::inst()->get(LoggerInterface::class);
26
27
        foreach (Logger::getLevels() as $name => $value) {
28
            $func = strtolower($name);
29
            $logger->$func('Testing Severity Level: ' . $name);
30
            printf("Security Level: %s <br/>\n", $name);
31
        }
32
33
    }
34
}
35