folder = $folder; } /** * @param string $name The name of the action e.g. "Display", "List", or "Connectivity" */ public function create(string $name): ActionInterface { $name = ucfirst(strtolower($name)) . 'Action'; $filePath = $this->folder . $name . '.php'; if(!file_exists($filePath)) { throw new \Exception('Invalid action'); } $className = '\\' . $name; return new $className(); } }