public function test($throw = true)
{
try {
// Include the plugin file.
if ($className = $this->getPluginClass()) {
list($_, $path) = $this->classes[$className];
include $this->path($path);
}
// Include the configuration file.
if ($configPath = $this->getSpecial('config')) {
include $this->path($configPath);
}
// Include locale files.
foreach ($this->getTranslationPaths() as $path) {
include $this->path($path);
}
return true;
} catch (\Throwable $ex) {
// PHP 7 can trap more errors, so cast it into a PHP 5.x compatible exception.
$ex2 = new \Exception($ex->getMessage(), $ex->getCode());
} catch (\Exception $ex) {
$ex2 = $ex;
}
if ($throw) {
throw $ex2;
} else {
return false;
}
}