classes/Factory/Definition.php
public static function getDefaultForClass($class, array $params = array())
	{
		$reflectionClass = new ReflectionClass($class);

		if (!$reflectionClass->isInstantiable()) {
			throw new NotInstantiableException("Class $class is not instantiable");
		}

		$factory = new static([$reflectionClass, 'newInstance'], "$class::__construct");

		if ($reflectionClass->hasMethod('__construct')) {
			static::addReflectionArguments($factory, $reflectionClass->getMethod('__construct'));
		}

		return $factory->getFactory($params);
	}
public static function getDefaultForClass($class, array $params = array())
	{
		$reflectionClass = new ReflectionClass($class);

		if (!$reflectionClass->isInstantiable()) {
			throw new NotInstantiableException("Class $class is not instantiable");
		}

		$factory = new static([$reflectionClass, 'newInstance'], "$class::__construct");

		if ($reflectionClass->hasMethod('__construct')) {
			static::addReflectionArguments($factory, $reflectionClass->getMethod('__construct'));
		}

		return $factory->getFactory($params);
	}
public static function getDefaultForClass ( $ class , array $ params = array ( ) ) { $ reflectionClass = new ReflectionClass ( $ class ) ; if ( ! $ reflectionClass -> isInstantiable ( ) ) { throw new NotInstantiableException ( "Class $class is not instantiable" ) ; } $ factory = new static ( [ $ reflectionClass , 'newInstance' ] , "$class::__construct" ) ; if ( $ reflectionClass -> hasMethod ( '__construct' ) ) { static :: addReflectionArguments ( $ factory , $ reflectionClass -> getMethod ( '__construct' ) ) ; } return $ factory -> getFactory ( $ params ) ; }
Get a default factory for a class.

@param  string $class
@param  array  $params Optional

@return FactoryInterface
Get a default factory for a class .