From 7bbf744a76ecaa97e18e9af46cf42026e223ed8d Mon Sep 17 00:00:00 2001 From: Yusuf Kandemir Date: Wed, 26 Dec 2018 08:36:03 +0300 Subject: [PATCH] Removed Microdata class and its test This is related with incoming changes in future commits. --- src/Microdata.php | 58 ----------------------------------------- tests/MicrodataTest.php | 36 ------------------------- 2 files changed, 94 deletions(-) delete mode 100644 src/Microdata.php delete mode 100644 tests/MicrodataTest.php diff --git a/src/Microdata.php b/src/Microdata.php deleted file mode 100644 index 4a3718b..0000000 --- a/src/Microdata.php +++ /dev/null @@ -1,58 +0,0 @@ -loadHTML($html, LIBXML_NOERROR); - $dom->documentURI = $documentURI; - - return new MicrodataParser($dom); - } - - /** - * Creates a MicrodataParser from a HTML file - * - * @param string $filename Path to the file to be parsed - * @param string $documentURI DocumentURI to be used in absolutizing URIs - * - * @return MicrodataParser - */ - public static function fromHTMLFile(string $filename, string $documentURI = '') : MicrodataParser - { - $dom = new MicrodataDOMDocument; - $dom->loadHTMLFile($filename, LIBXML_NOERROR); - $dom->documentURI = $documentURI; - - return new MicrodataParser($dom); - } - - /** - * Creates a MicrodataParser from a DOMDocument instance. - * If you have MicrodataDOMDocument then instantiate MicrodataParser class directly to avoid conversion. - * - * @param \DOMDocument $domDocument DOMDocument to be parsed. - * Needs to have documentURI property to be used in absolutizing URIs if wanted. - * - * @return MicrodataParser - */ - public static function fromDOMDocument(\DOMDocument $domDocument) : MicrodataParser - { - $dom = new MicrodataDOMDocument; - $importedNode = $dom->importNode($domDocument->documentElement, true); - $dom->appendChild($importedNode); - - return new MicrodataParser($dom); - } -} diff --git a/tests/MicrodataTest.php b/tests/MicrodataTest.php deleted file mode 100644 index d3a9aec..0000000 --- a/tests/MicrodataTest.php +++ /dev/null @@ -1,36 +0,0 @@ -htmlFileName); - $microdata = Microdata::fromHTML($html); - - $this->assertInstanceOf(MicrodataParser::class, $microdata); - } - - public function testItCreatesMicrodataParserFromHtmlFile() - { - $microdata = Microdata::fromHTMLFile($this->htmlFileName); - - $this->assertInstanceOf(MicrodataParser::class, $microdata); - } - - public function testItCreatesMicrodataParserFromDomDocument() - { - $dom = new \DOMDocument; - $dom->loadHTMLFile($this->htmlFileName); - - $microdata = Microdata::fromDOMDocument($dom); - - $this->assertInstanceOf(MicrodataParser::class, $microdata); - } -}