-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from NigelRel3/Composer
Updated project structure for composer
- Loading branch information
Showing
5 changed files
with
32 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
{ | ||
"name" : "xmlreaderreg/xmlreaderreg", | ||
"name" : "nigelrel3/xml-reader-reg", | ||
"description" : "XMLReader higher level interface", | ||
"type" : "library", | ||
"license" : "MIT", | ||
"authors" : [{ | ||
"name" : "NigelR", | ||
"email" : "[email protected]" | ||
} | ||
], | ||
"require-dev" : { | ||
"phpunit/phpunit" : "~8.4" | ||
"phpunit/phpunit" : "8.5.2", | ||
"symplify/easy-coding-standard" : "~7.2" | ||
}, | ||
"autoload" : { | ||
"psr-4" : { | ||
"XMLReaderReg\\" : "src" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace XMLReaderReg; | ||
|
||
use DOMDocument; | ||
use DOMElement; | ||
use DOMXPath; | ||
use ReflectionFunction; | ||
use SimpleXMLElement; | ||
use XMLReader; | ||
|
||
/** | ||
* @author NigelRen <[email protected]> | ||
*/ | ||
|
@@ -53,13 +61,13 @@ class XMLReaderReg extends XMLReader { | |
|
||
/** | ||
* Document used for importing data to SimpleXML or DOMElement | ||
* @var DOMDocument | ||
* @var \DOMDocument | ||
*/ | ||
private $doc = null; | ||
|
||
/** | ||
* Used for processing namespace removal. | ||
* @var DOMXPath | ||
* @var \DOMXPath | ||
*/ | ||
private $xpath = null; | ||
|
||
|
@@ -204,6 +212,7 @@ protected function startElement(): void { | |
// See if interesed in this data | ||
foreach ( $this->dataMatch as $pathReg => $closure ) { | ||
// Check if matches regex... | ||
$matches = []; | ||
if ( preg_match('#^'.$pathReg.'$#', $path, $matches) ) { | ||
$closure($this->{$this->callableParam [ $pathReg ]}(), $matches ); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters