Skip to content

Instantly share code, notes, and snippets.

@kaylarose
Created March 18, 2011 17:32
Show Gist options
  • Save kaylarose/876496 to your computer and use it in GitHub Desktop.
Save kaylarose/876496 to your computer and use it in GitHub Desktop.
KISS_Dynamic_Patterns
<?php
class Factory{
public static function create($name){
if(class_exists($name, TRUE)){
return new $name;
}else{
throw new IllegalArgumentException("$name is not an invalid or unknown type");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment