1 <?php
2
3 class Kint_Parsers_ClassStatics extends kintParser
4 {
5 protected function _parse( & $variable )
6 {
7 if ( !KINT_PHP53 || !is_object( $variable ) ) return false;
8
9 $extendedValue = array();
10
11 $reflection = new ReflectionClass( $variable );
12
13 foreach ( $reflection->getProperties( ReflectionProperty::IS_STATIC ) as $property ) {
14 if ( $property->isPrivate() ) {
15 if ( !method_exists( $property, 'setAccessible' ) ) {
16 break;
17 }
18 $property->setAccessible( true );
19 $access = "private";
20 } elseif ( $property->isProtected() ) {
21 $property->setAccessible( true );
22 $access = "protected";
23 } else {
24 $access = 'public';
25 }
26
27 $_ = $property->getValue();
28 $output = kintParser::factory( $_, '$' . $property->getName() );
29
30 $output->access = $access;
31 $output->operator = '::';
32 $extendedValue[] = $output;
33 }
34
35 foreach ( $reflection->getConstants() as $constant => $val ) {
36 $output = kintParser::factory( $val, $constant );
37
38 $output->access = 'constant';
39 $output->operator = '::';
40 $extendedValue[] = $output;
41 }
42
43 if ( empty( $extendedValue ) ) return false;
44
45 $this->value = $extendedValue;
46 $this->type = 'Static class properties';
47 $this->size = count( $extendedValue );
48 }
49 }