[TYPO3-50-general] Generic Object Access
Bastian Waidelich
bastian at typo3.org
Tue Jan 6 09:57:39 CET 2009
Sebastian Kurfürst wrote:
Hi Sebastian,
> http://forge.typo3.org/repositories/entry/package-flow3/trunk/Classes/Reflection/F3_FLOW3_Reflection_ObjectAccess.php?rev=1695
Hopefully properties make it into PHP as a language construct some day..
Until then this seems like a good solution for me!
Some notes regarding the code:
- line 24:
* [Enter description here]
lazy? ;]~
- line 50:
static public function getProperty($object, $property) {
This should be "$propertyName" instead of "$property" IMO as it does not
refer to the property but to its identifier.
- line 79:
static public function setProperty($object, $property, $propertyValue) {
The same here.
- line 102:
static public function getDeclaredPropertyNames($object) {
Why "declared"? could be just "getPropertyNames"
- line 111:
$properties = array_unique($declaredPropertyNames);
call me picky, but "$properties" -> "$propertyNames", no?
- line 116:
static public function getAllProperties($object) {
javadoc comments missing
- line 119:
echo $property;
¡Ay, caramba!
- line 148:
//if (property_exists($object, $property)) {
SVN does not like commented out code ;)
- line 149:
if (array_key_exists($property, get_class_vars(get_class($object)))) {
Why don't you use get_object_vars here? Then you wouldn't have to
convert the object to a class first.
- line 160:
static protected function buildGetterMethodName($property) {
no javadoc comments.
- line 163:
static protected function buildSetterMethodName($property) {
no javadoc comments.
All the best
Bastian
More information about the TYPO3-project-5_0-general
mailing list