static ObjectFactory.createObjectByName ( className,
array $  args = array() 
) [static, final]

Creates a new object given by the name or throws an exception if the class was not found.

No parameters for the object are currently supported.

Parameters:
$className Name of the class we shall construct
$args Arguments in an indexed array
Returns:
$objectInstance An instance of the requested object
Exceptions:
ClassNotFoundException If the requested class was not found
EmptyVariableException If a variable is empty unexpectly

Definition at line 51 of file class_ObjectFactory.php.

Referenced by WorksContract.addContractDetails(), ApplicationEntryPoint.app_die(), CompressorChannel.createCompressorChannel(), CacheFactory.createConfiguredCache(), DebugMiddleware.createDebugMiddleware(), WebNewsFactory.createFactoryByRequest(), BaseShip.createShipPart(), WorksContract.createWorksContract(), ApplicationHelper.entryPoint(), UserAuthFilter.execute(), ShipSimuLoginHelper.executeLogin(), AdminLoginHelper.executeLogin(), BaseActionResolver.loadAction(), WebCommandResolver.loadCommand(), ImageCommandResolver.loadCommand(), WebGovernmentFailedCommandResolver.loadCommand(), WebControllerResolver.loadController(), ImageControllerResolver.loadController(), and ImageTemplateEngine.setImageType().

00051                                                                                           {
00052                 // Is the class name valid and is the class there?
00053                 if (empty($className)) {
00054                         // First get an instance of this factory
00055                         $factoryInstance = new ObjectFactory();
00056 
00057                         // Throw an exception here
00058                         throw new EmptyVariableException(array($factoryInstance, 'className'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
00059                 } elseif (!class_exists($className)) {
00060                         // First get an instance of this factory
00061                         $factoryInstance = new ObjectFactory();
00062 
00063                         // Then throw an exception
00064                         throw new ClassNotFoundException(array($factoryInstance, $className), self::EXCEPTION_CLASS_NOT_FOUND);
00065                 }
00066 
00067                 // Create method name
00068                 $methodName = sprintf("create%s",
00069                         $className
00070                 );
00071 
00072                 // Run the user function
00073                 $objectInstance = call_user_func_array(array($className, $methodName), $args);
00074 
00075                 // Count generated objects up
00076                 self::$total++;
00077 
00078                 // Return the prepared instance
00079                 return $objectInstance;
00080         }

Here is the caller graph for this function:


Generated on Mon Dec 8 01:15:52 2008 for Ship-Simulator by  doxygen 1.5.6