Package class.
Protected constructor since this is a static class.
NULL
protected function __construct()
{
// Nothing here
}
Initializes a package.
| Type | Description |
|---|---|
| string | Package name |
NULL
public static function init($name)
{
$path = MAKO_PACKAGES . '/' . $name . '/_init.php';
if(!file_exists($path))
{
throw new RuntimeException(vsprintf("%s(): Unable to initialize the '%s' package. Make sure that it has been installed.", array(__METHOD__, $name)));
}
include_once $path;
}
Returns TRUE if package is installed and FALSE if not.
| Type | Description |
|---|---|
| string | Package name |
boolean
public static function installed($name)
{
return is_dir(MAKO_PACKAGES . '/' . $name);
}
Returns info about a package. FALSE is returned if no info file is found.
| Type | Description |
|---|---|
| string | Package name |
array
public static function info($name)
{
$path = MAKO_PACKAGES . '/' . $name . '/package.json';
if(file_exists($path))
{
return json_decode(file_get_contents($path), true);
}
return false;
}