Skip to content

Commit e2ced08

Browse files
authored
Merge pull request #105 from voku/analysis-g6g33E
Apply fixes from StyleCI
2 parents 9ef90f0 + 86b731f commit e2ced08

File tree

7 files changed

+3
-8
lines changed

7 files changed

+3
-8
lines changed

src/voku/helper/AbstractDomParser.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@ public static function replaceToPreserveHtmlEntities(string $html): string
497497
$linksOld = [];
498498

499499
if (\strpos($html, 'http') !== false) {
500-
501500
// regEx for e.g.: [https://www.domain.de/foo.php?foobar=1&email=lars%40moelleken.org&guid=test1233312&{{foo}}#foo]
502501
$regExUrl = '/(\[?\bhttps?:\/\/[^\s<>]+(?:\(\w+\)|[^[:punct:]\s]|\/|}|]))/i';
503502
\preg_match_all($regExUrl, $html, $linksOld);

src/voku/helper/HtmlDomHelper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
final class HtmlDomHelper
88
{
9-
109
/**
1110
* @param string $html
1211
* @param string $optionStr

src/voku/helper/HtmlDomParser.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,6 @@ protected function createDOMDocument(string $html, $libXMLExtraOptions = null, $
478478
}
479479

480480
if ($documentFound === false) {
481-
482481
// UTF-8 hack: http://php.net/manual/en/domdocument.loadhtml.php#95251
483482
$xmlHackUsed = false;
484483
if (\stripos('<?xml', $html) !== 0) {
@@ -1124,7 +1123,6 @@ static function ($value) {
11241123
$html = (string) \preg_replace_callback(
11251124
'/(?<start>(<script [^>]*type=["\']?(?:' . $tags . ')+[^>]*>))(?<innerContent>.*)(?<end><\/script>)/isU',
11261125
function ($matches) {
1127-
11281126
// Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>],
11291127
// because often this looks like non-valid html in the template itself.
11301128
foreach ($this->templateLogicSyntaxInSpecialScriptTags as $logicSyntaxInSpecialScriptTag) {

src/voku/helper/SimpleHtmlDom.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,6 @@ protected function cleanHtmlWrapper(
831831
||
832832
$newDocument->getIsDOMDocumentCreatedWithoutHtmlWrapper()
833833
) {
834-
835834
// Remove doc-type node.
836835
if ($newDocument->getDocument()->doctype !== null) {
837836
$newDocument->getDocument()->doctype->parentNode->removeChild($newDocument->getDocument()->doctype);

src/voku/helper/XmlDomParser.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ protected function createDOMDocument(string $xml, $libXMLExtraOptions = null, $u
204204
}
205205

206206
if ($documentFound === false) {
207-
208207
// UTF-8 hack: http://php.net/manual/en/domdocument.loadhtml.php#95251
209208
$xmlHackUsed = false;
210209
/** @noinspection StringFragmentMisplacedInspection */

tests/HtmlDomParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ public function testIssue96()
362362
$dom = new voku\helper\HtmlDomParser();
363363
$dom->load($html);
364364

365-
foreach($dom->findMulti('.mydiv .mydiv-item') as $childEl) {
365+
foreach ($dom->findMulti('.mydiv .mydiv-item') as $childEl) {
366366
$childEl->class = 'replaced';
367367
}
368368
foreach ($dom->findMulti('.mydiv') as $myDivEl) {

tests/XmlDomParserTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public function testXml()
2222
);
2323
}
2424

25-
public function testXMLWithoutLoadingDtd() {
25+
public function testXMLWithoutLoadingDtd()
26+
{
2627
$cxmlData = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.024/cXML.dtd"><cXML payloadID="dsfsfsdds" timestamp="2022-12-21T15:35:02+01:00" xml:lang="en-US"><Header><From><Credential domain="NetworkId"><Identity>sdfdfsdf-123</Identity></Credential></From><To><Credential domain="NetworkId"><Identity>fsdfdsfdsfds-321</Identity></Credential></To><Sender><Credential domain="NetworkId"><Identity>fsdfdsfds-1234</Identity></Credential><UserAgent>vdmg: Moelleken, Lars (VDMG-Connect)</UserAgent></Sender></Header><Message><PunchOutOrderMessage><BuyerCookie/><PunchOutOrderMessageHeader operationAllowed="edit"><Total><Money currency="EUR">2.13</Money></Total></PunchOutOrderMessageHeader><ItemIn quantity="1"><ItemID><SupplierPartID>43423342</SupplierPartID></ItemID><ItemDetail><UnitPrice><Money currency="EUR">2.13</Money></UnitPrice><Description xml:lang="de">Stahlblech 10 mm 1200</Description><Classification domain="UNSPSC"/></ItemDetail></ItemIn></PunchOutOrderMessage></Message></cXML>';
2728

2829
$xmlParser = new \voku\helper\XmlDomParser();

0 commit comments

Comments
 (0)