PHP Code that follows UML diagram