Changeset 40
- Timestamp:
- 08/31/06 22:02:54 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/XJConf/converters/ConstructorValueConverter.php
r22 r40 48 48 $cParams[] = $conParam->convertValue($tag); 49 49 } 50 50 51 if (count($cParams) == 1 && empty($cParams[0]) == true) { 52 $cParams = array(); 53 } 54 51 55 // try to create a new instance 52 56 try { 53 57 $refClass = new ReflectionClass($this->className); 54 if ( method_exists($refClass, 'newInstanceArgs')) {55 $instance = $refClass->newInstanceArgs($cParams);58 if (count($cParams) > 1 && method_exists($refClass, 'newInstanceArgs') == true) { 59 $instance = $refClass->newInstanceArgs($cParams); 56 60 } elseif (count($cParams) == 1) { 57 61 $instance = $refClass->newInstance($cParams[0]); 62 } elseif (count($cParams) == 0) { 63 $instance = $refClass->newInstance(); 58 64 } else { 59 65 throw new ValueConversionException('Could not create instance of "' . $this->className . '" as Reflection does not support newInstanceArgs().');
