Setting up key functionality

This commit is contained in:
Dennis Eichhorn 2016-04-02 17:55:42 +02:00
parent b4fae9cb67
commit a1cbf8f2bb

View File

@ -60,12 +60,16 @@ class InfoManager
* @author Dennis Eichhorn * @author Dennis Eichhorn
*/ */
public function __construct(string $module) public function __construct(string $module)
{
$this->path = $path;
}
public function load()
{ {
if (($path = realpath($oldPath = ModuleAbstract::MODULE_PATH . '/' . $module . '/info.json')) === false || Validator::startsWith($path, ModuleAbstract::MODULE_PATH)) { if (($path = realpath($oldPath = ModuleAbstract::MODULE_PATH . '/' . $module . '/info.json')) === false || Validator::startsWith($path, ModuleAbstract::MODULE_PATH)) {
throw new PathException($oldPath); throw new PathException($oldPath);
} }
$this->path = $path;
$this->info = json_decode(file_get_contents($this->path), true); $this->info = json_decode(file_get_contents($this->path), true);
} }
@ -111,4 +115,34 @@ class InfoManager
{ {
return $this->info; return $this->info;
} }
public function getInternalName() : string
{
return $this->info['name']['internal'];
}
public function getDependencies() : string
{
return $this->info['dependencies'];
}
public function getProviding() : string
{
return $this->info['providing'];
}
public function getDirectory() : string
{
return $this->info['directory'];
}
public function getVersion() : string
{
return $this->info['version'];
}
public function getLoad() : string
{
return $this->info['load'];
}
} }