Kint_Renderer_Cli::postRender()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
4
class Kint_Renderer_Cli extends Kint_Renderer_Text
0 ignored issues
show
Coding Style introduced by
Kint_Renderer_Cli does not seem to conform to the naming convention (^[A-Z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Coding Style introduced by
The property $cli_colors is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
Coding Style introduced by
The property $force_utf8 is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
Coding Style introduced by
The property $detect_width is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
Coding Style introduced by
The property $min_terminal_width is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
Coding Style introduced by
The property $terminal_width is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
Coding Style introduced by
The property $windows_output is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
5
{
6
    /**
7
     * @var bool enable colors when Kint is run in *UNIX* command line
8
     */
9
    public static $cli_colors = true;
0 ignored issues
show
Coding Style introduced by
$cli_colors does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
10
11
    /**
12
     * Forces utf8 output on windows.
13
     *
14
     * @var bool
15
     */
16
    public static $force_utf8 = false;
0 ignored issues
show
Coding Style introduced by
$force_utf8 does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
17
18
    /**
19
     * Detects the terminal width on startup.
20
     *
21
     * @var bool
22
     */
23
    public static $detect_width = true;
0 ignored issues
show
Coding Style introduced by
$detect_width does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
24
25
    /**
26
     * The minimum width to detect terminal size as.
27
     *
28
     * Less than this is ignored and falls back to default width.
29
     *
30
     * @var int
31
     */
32
    public static $min_terminal_width = 40;
0 ignored issues
show
Coding Style introduced by
$min_terminal_width does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
33
34
    protected static $terminal_width = null;
0 ignored issues
show
Coding Style introduced by
$terminal_width does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
35
36
    protected $windows_output = false;
0 ignored issues
show
Coding Style introduced by
$windows_output does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
37
38
    public function __construct(array $params = array())
39
    {
40
        parent::__construct($params);
41
42
        if (!self::$force_utf8) {
43
            $this->windows_output = KINT_WIN;
44
        }
45
46
        if (!self::$terminal_width) {
47
            if (!KINT_WIN && self::$detect_width) {
48
                self::$terminal_width = exec('tput cols');
49
            }
50
51
            if (self::$terminal_width < self::$min_terminal_width) {
52
                self::$terminal_width = self::$default_width;
53
            }
54
        }
55
56
        $this->header_width = self::$terminal_width;
57
    }
58
59 View Code Duplication
    protected function utf8_to_windows($string)
0 ignored issues
show
Coding Style introduced by
function utf8_to_windows() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
60
    {
61
        return str_replace(
62
            array('┌', '═', '┐', '│', '└', '─', '┘'),
63
            array("\xda", "\xdc", "\xbf", "\xb3", "\xc0", "\xc4", "\xd9"),
64
            $string
65
        );
66
    }
67
68 View Code Duplication
    public function colorValue($string)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
69
    {
70
        if (!self::$cli_colors) {
71
            return $string;
72
        } else {
73
            return "\x1b[32m".str_replace("\n", "\x1b[0m\n\x1b[32m", $string)."\x1b[0m";
74
        }
75
    }
76
77 View Code Duplication
    public function colorType($string)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
78
    {
79
        if (!self::$cli_colors) {
80
            return $string;
81
        } else {
82
            return "\x1b[35;1m".str_replace("\n", "\x1b[0m\n\x1b[35;1m", $string)."\x1b[0m";
83
        }
84
    }
85
86 View Code Duplication
    public function colorTitle($string)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
87
    {
88
        if (!self::$cli_colors) {
89
            return $string;
90
        } else {
91
            return "\x1b[36m".str_replace("\n", "\x1b[0m\n\x1b[36m", $string)."\x1b[0m";
92
        }
93
    }
94
95
    public function renderTitle(Kint_Object $o)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $o. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
96
    {
97
        if ($this->windows_output) {
98
            return $this->utf8_to_windows(parent::renderTitle($o));
99
        } else {
100
            return parent::renderTitle($o);
101
        }
102
    }
103
104
    public function preRender()
105
    {
106
        return PHP_EOL;
107
    }
108
109
    public function postRender()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
110
    {
111
        if ($this->windows_output) {
112
            return $this->utf8_to_windows(parent::postRender());
113
        } else {
114
            return parent::postRender();
115
        }
116
    }
117
118
    public function escape($string, $encoding = false)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
119
    {
120
        return str_replace("\x1b", '\\x1b', $string);
121
    }
122
}
123