Skip to content

Instantly share code, notes, and snippets.

@ringmaster
Last active October 1, 2015 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ringmaster/1933104 to your computer and use it in GitHub Desktop.
Save ringmaster/1933104 to your computer and use it in GitHub Desktop.
Fluid PHP Create
<?php
// Explained (somewhat) at http://redalt.com/fluid-php-baseobject-class
trait FluentCreate
{
public static function create()
{
$class = get_called_class();
$args = func_get_args();
$r_class = new \ReflectionClass($class);
return $r_class->newInstanceArgs($args);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment