protected function matches($html, $pattern) { preg_match_all($pattern, $html, $matches, PREG_OFFSET_CAPTURE); if (!isset($matches[0])) { return array(); } return $matches[0]; }