getHookInstance($name, $params); if (!$hookInstance) { return $params; } try { $newParams = $hookInstance->execute(); return $newParams; } catch (\Exception $exception) { $this->logException($exception); return $params; } } public function getHookInstance($name = null, $params = []) { $fullInstanceName = '\ModulesGarden\Servers\ProxmoxCloudVps\App\Hooks\InternalHooks\\' . $name; if (!class_exists($fullInstanceName)) { return false; } try { $instance = new $fullInstanceName($params); } catch (\Exception $exception) { $this->logException($exception); return false; } if (!is_callable([$instance, 'execute']) || !($instance instanceof InternalHook)) { return false; } return $instance; } public function logException($exception) { //todo } }