BrowserOutputter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A write() 0 5 3
1
<?php
2
namespace WebStream\Log\Outputter;
3
4
/**
5
 * BrowserOutputter
6
 * @author Ryuichi Tanaka
7
 * @since 2016/01/26
8
 * @version 0.7
9
 */
10
class BrowserOutputter implements IOutputter
11
{
12
    /**
13
     * https://github.com/php/php-src/tree/master/sapi
14
     * PHP7以前のものは対応しない
15
     * @var SAPIリスト
0 ignored issues
show
Documentation Bug introduced by
The doc comment SAPIリスト at position 0 could not be parsed: Unknown type name 'SAPIリスト' at position 0 in SAPIリスト.
Loading history...
16
     */
17
    private $sapis = [
18
        'apache2handler' => 'http',
19
        'cgi'            => 'http',
20
        'cli'            => 'console',
21
        'fpm'            => 'http',
22
        'embed'          => 'unsupported',
23
        'litespeed'      => 'unsupported',
24
        'phpdbg'         => 'unsupported',
25
        'tests'          => 'unsupported'
26
    ];
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function write($text)
32
    {
33
        $sapi = php_sapi_name();
34
        if (array_key_exists($sapi, $this->sapis) && $this->sapis[$sapi] === 'http') {
35
            echo $text . "<br>";
36
        }
37
    }
38
}
39