Blame view

framework/control/injector/InjectionCreator.php 434 Bytes
0084d336   Administrator   Importers CRUD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  <?php
  
  use SilverStripe\Framework\Injector\Factory;
  
  /**
   * A class for creating new objects by the injector.
   *
   * @package framework
   * @subpackage 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();
  	}
  
  }