public function __construct($computer = ".", $user = null, $password = null) { $this->Computer = $computer; // Get class constants ; this is useful for the GetValue() method, which takes a root key and key path // that must be mapped to a string like "\\rootkey\keypath" $reflector = new \ReflectionClass(__CLASS__); self::$ClassConstants = $reflector->getConstants(); // Get OS architecture if (self::$OsArchitecture === null) { self::$OsArchitecture = self::GetOsArchitecture(); } // Check if we need to connect to a local or remote registry if ($computer !== "." && $computer !== "localhost") { $locator = new \COM("WbemScripting.SWbemLocator"); $this->WmiInstance = $locator->ConnectServer($computer, "root/default:StdRegProv", $user, $password); } else { $this->WmiInstance = new \COM(str_ireplace("{Computer}", $computer, self::REGISTRY_STANDARD_OBJECT)); } }