load($str); } /** * Creates a new dom object and calls loadFromFile() on the * new object. * * @param string $file * @return Dom */ public static function loadFromFile(string $file): Dom { $dom = new Dom; self::$dom = $dom; return $dom->loadFromFile($file); } /** * Creates a new dom object and calls loadFromUrl() on the * new object. * * @param string $url * @param array $options * @param CurlInterface $curl * @return Dom */ public static function loadFromUrl(string $url, array $options = [], CurlInterface $curl = null): Dom { $dom = new Dom; self::$dom = $dom; if (is_null($curl)) { // use the default curl interface $curl = new Curl; } return $dom->loadFromUrl($url, $options, $curl); } /** * Sets the $dom variable to null. */ public static function unload(): void { self::$dom = null; } }