Created
March 19, 2015 14:18
-
-
Save aranega/6d51abc45c39c6b2ae14 to your computer and use it in GitHub Desktop.
PHP Generator samples for "Build your own PHP" articles (http://blog.genmymodel.com)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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