Skip to content

Instantly share code, notes, and snippets.

@innermond
Created November 28, 2014 11:43
Show Gist options
  • Select an option

  • Save innermond/99f572335db0a204137e to your computer and use it in GitHub Desktop.

Select an option

Save innermond/99f572335db0a204137e to your computer and use it in GitHub Desktop.
a trait that gives static factory ability to the classes parasitized by it
trait StaticFactory
{
public static function Make()
{
$args = \func_get_args();
$class = new \ReflectionClass(get_called_class());
$instance = $class->newInstanceArgs($args);
return $instance;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment