Kint_Object_Representation::getLabel()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 2
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
class Kint_Object_Representation
0 ignored issues
show
Coding Style introduced by
Kint_Object_Representation 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 $implicit_label 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...
4
{
5
    public $name;
6
    public $label;
7
    public $implicit_label = false;
0 ignored issues
show
Coding Style introduced by
$implicit_label 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...
8
    public $hints = array();
9
    public $contents = array();
10
11
    public function __construct($label, $name = null)
12
    {
13
        $this->label = $label;
14
15
        if ($name === null) {
16
            $name = preg_replace('/[^a-z0-9]+/', '_', strtolower($label));
0 ignored issues
show
Coding Style introduced by
Consider using a different name than the parameter $name. This often makes code more readable.
Loading history...
17
        }
18
19
        $this->name = $name;
20
    }
21
22
    public function getLabel()
23
    {
24
        if (is_array($this->contents) && count($this->contents) > 1) {
25
            return $this->label.' ('.count($this->contents).')';
26
        } else {
27
            return $this->label;
28
        }
29
    }
30
31
    public function labelIsImplicit()
0 ignored issues
show
Coding Style introduced by
function labelIsImplicit() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

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...
32
    {
33
        return $this->implicit_label;
34
    }
35
}
36