Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PHP Generator samples for "Build your own PHP" articles (http://blog.genmymodel.com)
[module PHP('http://www.eclipse.org/uml2/4.0.0/UML')/]
[template public generate(c : Class)]
[comment @main/]
[file (c.name + '.php', false, 'UTF-8')]
<?php
[if (c.generalization->notEmpty())]require_once("[c.generalization.general.name/].php");[/if]
[for (s : String | c.interfaceRealization.contract.name)]
require_once("[s/].php");
[/for]
[if (c.isAbstract)]abstract [/if]class [c.name/][if (c.generalization->notEmpty())] extends [c.generalization.general.name/][/if][if (c.interfaceRealization->notEmpty())] implements [c.interfaceRealization.contract.name->sep(', ')/][/if]
{
}
?>
[/file]
[/template]
[template public generate(i : Interface)]
[comment @main/]
[file (i.name + '.php', false, 'UTF-8')]
<?php
[if (i.generalization->notEmpty())]require_once("[i.generalization.general.name/].php");[/if]
[if (i.isAbstract)]abstract [/if]interface [i.name/][if (i.generalization->notEmpty())] extends [i.generalization.general.name/][/if]
{
}
?>
[/file]
[/template]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment