Skip to content

Instantly share code, notes, and snippets.

@fprochazka
Created August 11, 2010 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fprochazka/518847 to your computer and use it in GitHub Desktop.
Save fprochazka/518847 to your computer and use it in GitHub Desktop.
<?php
abstract class Dependencies extends \Nette\Object
{
/**
* Package version
*/
//const VERSION = 0; // 1.0.0
/**
* Unique key generated by system for specific extension
*/
//const EXT_KEY = NULL;
/**
* List of dependencies that must be met for appropriate behaviour
*/
protected $dependencies = array(
//'dependencyKey' => array('>=', 'version');
);
private $init = False;
public function __construct()
{
if( !defined(get_class($this).'::VERSION') OR !defined(get_class($this).'::EXT_KEY') ){
throw new InvalidExtensionSetupException("Extension loader ".get_class($this)." has to have VERSION & EXT_KEY constants declared.");
}
// kontrola závislostí
$this->init = True;
}
final public function isInitialized()
{
return $this->init;
}
final public function getVersion()
{
return constant(get_class($this).'::VERSION');
}
final public function getExtKey()
{
return constant(get_class($this).'::EXT_KEY');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment