1<?php
2	function inspectClass($class) {
3
4		/* not used: public ReflectionClass[] getInterfaces()  */
5
6		printf("\nInspecting class '%s'\n", $class->getName());
7		printf("isInternal: %s\n", ($class->isInternal()) ? 'yes' : 'no');
8		printf("isUserDefined: %s\n", ($class->isUserDefined()) ? 'yes' : 'no');
9		printf("isInstantiable: %s\n", ($class->isInstantiable()) ? 'yes' : 'no');
10		printf("isInterface: %s\n", ($class->isInterface()) ? 'yes' : 'no');
11		printf("isAbstract: %s\n", ($class->isAbstract()) ? 'yes' : 'no');
12		printf("isFinal: %s\n", ($class->isFinal()) ? 'yes' : 'no');
13		printf("isIteratable: %s\n", ($class->isIterateable()) ? 'yes' : 'no');
14		printf("Modifiers: '%d'\n", $class->getModifiers());
15		printf("Parent Class: '%s'\n", $class->getParentClass());
16		printf("Extension: '%s'\n", $class->getExtensionName());
17
18		if ($method = $class->getConstructor())
19			inspectMethod($method);
20
21		if ($methods = $class->getMethods()) {
22			$tmp = array();
23			foreach ($methods as $method)
24				$tmp[$method->getName()] = $method;
25
26			ksort($tmp, SORT_STRING);
27			foreach ($tmp as $method)
28				inspectMethod($method);
29		}
30
31		if ($properties = $class->getProperties()) {
32			$tmp = array();
33			foreach ($properties as $prop)
34				$tmp[$prop->getName()] = $prop;
35			ksort($tmp, SORT_STRING);
36			foreach ($tmp as $prop)
37			inspectProperty($prop);
38		}
39
40
41		if ($properties = $class->getDefaultProperties()) {
42			ksort($properties, SORT_STRING);
43			foreach ($properties as $name => $v)
44				printf("Default property '%s'\n", $name);
45		}
46
47		if ($properties = $class->getStaticProperties()) {
48			ksort($properties, SORT_STRING);
49			foreach ($properties as $name => $v)
50				printf("Static property '%s'\n", $name);
51		}
52
53		if ($constants = $class->getConstants()) {
54			ksort($constants, SORT_STRING);
55			foreach ($constant as $name => $value)
56				printf("Constant '%s' = '%s'\n", $name, $value);
57		}
58
59	}
60
61	function inspectProperty(&$prop) {
62
63		printf("\nInspecting property '%s'\n", $prop->getName());
64		printf("isPublic: %s\n", ($prop->isPublic()) ? 'yes' : 'no');
65		printf("isPrivate: %s\n", ($prop->isPrivate()) ? 'yes' : 'no');
66		printf("isProtected: %s\n", ($prop->isProtected()) ? 'yes' : 'no');
67		printf("isStatic: %s\n", ($prop->isStatic()) ? 'yes' : 'no');
68		printf("isDefault: %s\n", ($prop->isDefault()) ? 'yes' : 'no');
69		printf("Modifiers: %d\n", $prop->getModifiers());
70		// printf("Value\n"); var_export($prop->getValue());
71
72	}
73
74	function inspectMethod(&$method) {
75
76		printf("\nInspecting method '%s'\n", $method->getName());
77		printf("isFinal: %s\n", ($method->isFinal()) ? 'yes' : 'no');
78		printf("isAbstract: %s\n", ($method->isAbstract()) ? 'yes' : 'no');
79		printf("isPublic: %s\n", ($method->isPublic()) ? 'yes' : 'no');
80		printf("isPrivate: %s\n", ($method->isPrivate()) ? 'yes' : 'no');
81		printf("isProtected: %s\n", ($method->isProtected()) ? 'yes' : 'no');
82		printf("isStatic: %s\n", ($method->isStatic()) ? 'yes' : 'no');
83		printf("isConstructor: %s\n", ($method->isConstructor()) ? 'yes' : 'no');
84		printf("isDestructor: %s\n", ($method->isDestructor()) ? 'yes' : 'no');
85		printf("isInternal: %s\n", ($method->isInternal()) ? 'yes' : 'no');
86		printf("isUserDefined: %s\n", ($method->isUserDefined()) ? 'yes' : 'no');
87		printf("returnsReference: %s\n", ($method->returnsReference()) ? 'yes' : 'no');
88		printf("Modifiers: %d\n", $method->getModifiers());
89		printf("Number of Parameters: %d\n", $method->getNumberOfParameters());
90		printf("Number of Required Parameters: %d\n", $method->getNumberOfRequiredParameters());
91
92		if ($params = $method->getParameters()) {
93			$tmp = array();
94			foreach ($params as $k => $param)
95				$tmp[$param->getName()] = $param;
96
97//			ksort($tmp, SORT_STRING);
98			foreach ($tmp as $param)
99				inspectParameter($method, $param);
100		}
101
102		if ($static = $method->getStaticVariables()) {
103			sort($static, SORT_STRING);
104			printf("Static variables: %s\n", implode('/', $static));
105		}
106
107	}
108
109	function inspectParameter(&$method, &$param) {
110
111		printf("\nInspecting parameter '%s' of method '%s'\n",
112		$param->getName(), $method->getName());
113		printf("isArray: %s\n", ($param->isArray()) ? 'yes': 'no');
114		printf("allowsNull: %s\n", ($param->allowsNull()) ? 'yes' : 'no');
115		printf("isPassedByReference: %s\n", ($param->isPassedByReference()) ? 'yes' : 'no');
116		printf("isOptional: %s\n", ($param->isOptional()) ? 'yes' : 'no');
117		printf("isDefaultValueAvailable: %s\n", ($param->isDefaultValueAvailable()) ? 'yes' : 'no');
118		// printf("getDefaultValue: %s\n", ($param->getDefaultValue()) ? 'yes' : 'no');
119
120	}
121?>