File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ public function __construct(string $html)
44
44
require_once ( __DIR__ . '/Config.php ' );
45
45
$ this ->config = new Config ();
46
46
47
+ $ this ->prefix = $ this ->config ->getPrefix ();
48
+
47
49
libxml_use_internal_errors (true );
48
50
49
51
$ this ->html = $ html ;
@@ -126,6 +128,7 @@ private function init()
126
128
if (!$ this ->hasHtml ()) throw new Exception ('No HTML to parse ! ' );
127
129
128
130
$ finder = new DomXPath ($ this ->dom );
131
+
129
132
$ nodes = $ finder ->query ("//*[contains(@class, ' $ this ->prefix ')] " );
130
133
131
134
foreach ($ nodes as $ node ) {
Original file line number Diff line number Diff line change @@ -28,10 +28,15 @@ class Parser
28
28
/**
29
29
* @var string
30
30
*/
31
- private $ prefix = " prs " ;
31
+ private $ prefix ;
32
32
33
33
public function __construct (string $ data )
34
34
{
35
+ require_once ( __DIR__ . '/Config.php ' );
36
+ $ this ->config = new Config ();
37
+
38
+ $ this ->prefix = $ this ->config ->getPrefix ();
39
+
35
40
$ this ->data = json_decode ($ data );
36
41
37
42
$ this ->dom = new DOMDocument (1.0 , 'UTF-8 ' );
@@ -52,7 +57,7 @@ static function parse($data)
52
57
*/
53
58
public function getPrefix (): string
54
59
{
55
- return $ this ->prefix ;
60
+ return ! empty ( $ this ->prefix ) ? $ this -> prefix : $ this -> config -> getPrefix () ;
56
61
}
57
62
58
63
/**
You can’t perform that action at this time.
0 commit comments