1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
class Kint_Renderer_Rich_Callable extends Kint_Renderer_Rich_Plugin |
|
|
|
|
4
|
|
|
{ |
5
|
|
|
protected static $method_cache = array(); |
|
|
|
|
6
|
|
|
|
7
|
|
|
public function render($o) |
|
|
|
|
8
|
|
|
{ |
9
|
|
|
if ($o instanceof Kint_Object_Method && strlen($o->owner_class) && strlen($o->name) && !empty(self::$method_cache[$o->owner_class][$o->name])) { |
10
|
|
|
$children = self::$method_cache[$o->owner_class][$o->name]['children']; |
11
|
|
|
|
12
|
|
|
$header = $this->renderer->renderHeaderWrapper($o, (bool) strlen($children), self::$method_cache[$o->owner_class][$o->name]['header']); |
13
|
|
|
|
14
|
|
|
return '<dl>'.$header.$children.'</dl>'; |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
$children = $this->renderer->renderChildren($o); |
18
|
|
|
|
19
|
|
|
$header = ''; |
20
|
|
|
|
21
|
|
|
if (($s = $o->getModifiers()) !== null) { |
|
|
|
|
22
|
|
|
$header .= '<var>'.$s.'</var> '; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
if (($s = $o->getName()) !== null) { |
26
|
|
|
$function = $this->renderer->escape($s).'('.$this->renderer->escape($o->getParams()).')'; |
27
|
|
|
|
28
|
|
View Code Duplication |
if (($url = $o->getPhpDocUrl()) !== null) { |
|
|
|
|
29
|
|
|
$function = '<a href="'.$url.'" target=_blank>'.$function.'</a>'; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
$header .= '<dfn>'.$function.'</dfn>'; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
if (!empty($o->returntype)) { |
36
|
|
|
$header .= ': <var>'.$this->renderer->escape($o->returntype).'</var>'; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
View Code Duplication |
if (($s = $o->getValueShort()) !== null) { |
|
|
|
|
40
|
|
|
if (Kint_Renderer_Rich::$strlen_max && Kint_Object_Blob::strlen($s) > Kint_Renderer_Rich::$strlen_max) { |
41
|
|
|
$s = substr($s, 0, Kint_Renderer_Rich::$strlen_max).'...'; |
42
|
|
|
} |
43
|
|
|
$header .= ' '.$this->renderer->escape($s); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
if ($o instanceof Kint_Object_Method && strlen($o->owner_class) && strlen($o->name)) { |
47
|
|
|
$cache = array( |
48
|
|
|
'header' => $header, |
49
|
|
|
'children' => $children, |
50
|
|
|
); |
51
|
|
|
|
52
|
|
|
if (!isset(self::$method_cache[$o->owner_class])) { |
53
|
|
|
self::$method_cache[$o->owner_class] = array($o->name => $cache); |
54
|
|
|
} elseif (!isset(self::$method_cache[$o->owner_class][$o->name])) { |
55
|
|
|
self::$method_cache[$o->owner_class][$o->name] = $cache; |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
$header = $this->renderer->renderHeaderWrapper($o, (bool) strlen($children), $header); |
60
|
|
|
|
61
|
|
|
return '<dl>'.$header.$children.'</dl>'; |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
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.