destination = $destination; } /** * Creates the specified destination object. */ public function create(): object { // Build the class name. $class = self::$prefix . $this->destination; // If class doesn't exist, try within the Pro directory. if (!class_exists($class)) { $class = str_replace(self::$prefix, self::$pro_prefix, $class); } if (!class_exists($class)) { throw new \RuntimeException( sprintf( 'No way to instantiate class %s. Class doesn\'t exist.', $class ) ); } return new $class(); } }