mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-08 13:28:39 +00:00
Setting up key functionality
This commit is contained in:
parent
b4fae9cb67
commit
a1cbf8f2bb
|
|
@ -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'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user