function fromHtml($ex = null, $asDom = true) { $f = $this->f; $context = $ex instanceof MatcherContext ? $ex : new MatcherContext($ex); return new Matcher(function ($html) use($asDom, $context, $f) { return $f(Matcher::loadHTML($html, $asDom), $context); }); }