Last active
August 29, 2015 14:02
-
-
Save mishak87/2f4b8afbc406735d184e to your computer and use it in GitHub Desktop.
Hyphotetical: Example of generating php code with latte
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
<?php | |
/** | |
* {reusable} | |
*/ | |
class GenericLogOnEventSubscriber implements Subscriber | |
{ | |
/** | |
* {args2prop [ private|public|protected]} | |
*/ | |
function __construct(Logger $logger, $format); | |
function getSubscribedEvents() | |
{ | |
return [ /* {$event} */ => 'eventHandler' ]; | |
} | |
function eventHandler() | |
{ | |
$this->logger->log(spritfv($format, func_get_args())) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It could be done by extracting comments and parsing them as templates. If rendered template is empty or only whitespaces removing comment else writing output. Some macros could just set flags etc.