mako\Package


Description


Package class.


Class methods


Toggle source

protected __construct()


Protected constructor since this is a static class.

Return value

NULL

protected function __construct()
{
	// Nothing here
}

Toggle source

public static init($name)


Initializes a package.


Parameters

Type Description
string Package name
Return value

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;
}

Toggle source

public static installed($name)


Returns TRUE if package is installed and FALSE if not.


Parameters

Type Description
string Package name
Return value

boolean

public static function installed($name)
{
	return is_dir(MAKO_PACKAGES . '/' . $name);
}

Toggle source

public static info($name)


Returns info about a package. FALSE is returned if no info file is found.


Parameters

Type Description
string Package name
Return value

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;
}