Skip to content

Commit

Permalink
Merge ec15b7c into 175e86b
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaronSVK committed Oct 27, 2014
2 parents 175e86b + ec15b7c commit dcbe937
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Csfd/Parsers/Parser.php
Expand Up @@ -10,6 +10,8 @@
abstract class Parser
{

static protected $_crawlers = [];

protected function match($subject, $pattern)
{
$matches = [];
Expand Down Expand Up @@ -39,7 +41,14 @@ protected function splitByBr($text)

protected function getNode($html, $xpath)
{
$nodes = new Crawler($html);
$hash = md5($html);
if (!isset(static::$_crawlers[$hash]))
{
$nodes = new Crawler($html);
} else {
$nodes = static::$_crawlers[$hash];
}

$filtered = $nodes->filterXPath($xpath);
if ($filtered->count() === 0)
{
Expand Down

0 comments on commit dcbe937

Please sign in to comment.