mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-08 18:51:12 +02:00
Cleanup of framework's use of @package and @subpackage labels and additional of labels for classes missing packages. Moved all GridField related components to the one name. Countless spelling fixes, grammar for other comments. Link ClassName references in file headers.
26 lines
540 B
PHP
26 lines
540 B
PHP
<?php
|
|
|
|
/**
|
|
* A class for creating new objects by the injector.
|
|
*
|
|
* @package framework
|
|
* @subpackage injector
|
|
*/
|
|
class InjectionCreator {
|
|
|
|
/**
|
|
* @param string $object
|
|
* A string representation of the class to create
|
|
* @param array $params
|
|
* An array of parameters to be passed to the constructor
|
|
*/
|
|
public function create($class, $params = array()) {
|
|
$reflector = new ReflectionClass($class);
|
|
|
|
if (count($params)) {
|
|
return $reflector->newInstanceArgs($params);
|
|
}
|
|
|
|
return $reflector->newInstance();
|
|
}
|
|
} |