silverstripe-framework/Core/Injector/InjectionCreator.php
Damian Mooyman 8dd644d25d
API Namespace all classes
Namespace all templates
Move difflib and BBCodeParser2 to thirdparty
Remove deprecated API marked for removal in 4.0
2016-09-08 10:23:17 +12:00

23 lines
397 B
PHP

<?php
namespace SilverStripe\Core\Injector;
use ReflectionClass;
/**
* A class for creating new objects by the injector.
*/
class InjectionCreator implements Factory {
public function create($class, array $params = array()) {
$reflector = new ReflectionClass($class);
if (count($params)) {
return $reflector->newInstanceArgs($params);
}
return $reflector->newInstance();
}
}