getData(); $this->commands = $data['commands']; $this->packages = $data['packages']; $this->triggers = $data['triggers']; } /** * Returns a specific command. */ public function getCommand(int $commandID): ?Command { if (isset($this->commands[$commandID])) { return $this->commands[$commandID]; } return null; } /** * Returns a specific command defined by a trigger. */ public function getCommandByTrigger(string $trigger): ?Command { if (isset($this->triggers[$trigger])) { return $this->commands[$this->triggers[$trigger]]; } return null; } /** * Returns the command defined by the given package and identifier. */ public function getCommandByPackageAndIdentifier(Package $package, string $identifier): ?Command { if (isset($this->packages[$package->packageID][$identifier])) { return $this->packages[$package->packageID][$identifier]; } return null; } /** * Returns all commands. * * @return Command[] */ public function getCommands() { return $this->commands; } /** * Returns all triggers. * * @return int[] */ public function getTriggers() { return $this->triggers; } }