Skip to content

Instantly share code, notes, and snippets.

@fprochazka
Created October 5, 2012 09:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fprochazka/3838981 to your computer and use it in GitHub Desktop.
Save fprochazka/3838981 to your computer and use it in GitHub Desktop.
Velocity http://velocity.apache.org/engine/ template for PhpStorm & #nettefw
<?php
#set( $Class_prefix = ${NAME.substring(0, $NAME.indexOf('Extension'))} )
#set( $Extension_name = ${Class_prefix.toLowerCase()} )
#parse("PHP File Header.php")
namespace Kdyby\Extension\\${Class_prefix};
use Kdyby;
use Nette;
/**
* @author Filip Procházka <filip@prochazka.su>
*/
class ${Class_prefix}Extension extends Nette\Config\CompilerExtension
{
/**
* @var array
*/
public \$defaults = array(
);
public function loadConfiguration()
{
\$builder = \$this->getContainerBuilder();
\$config = \$this->getConfig(\$this->defaults);
}
/**
* @param \Nette\Config\Configurator \$configurator
*/
public static function register(Nette\Config\Configurator \$configurator)
{
\$configurator->onCompile[] = function (\$config, Nette\Config\Compiler \$compiler) {
\$compiler->addExtension('${Extension_name}', new ${Class_prefix}Extension());
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment