Example #1
0
 /**
  * Factory method to make the object,
  * load html string
  * object will be ready, can just
  * call echo $obj to get result of transformation
  *
  * @param string $sHtml input html string
  * @return object of this class
  */
 public static function factory($sHtml)
 {
     $o = new self();
     $o->loadHtml($sHtml);
     return $o;
 }
Example #2
0
 public static function fromHtml($htmlString)
 {
     $me = new self();
     $me->loadHtml($htmlString);
     return $me;
 }
Example #3
0
 /**
  * @param $name
  * @param $arguments
  *
  * @return HtmlDomParser
  */
 public static function __callStatic($name, $arguments)
 {
     $arguments0 = null;
     if (isset($arguments[0])) {
         $arguments0 = $arguments[0];
     }
     $arguments1 = null;
     if (isset($arguments[1])) {
         $arguments1 = $arguments[1];
     }
     if ($name === 'str_get_html') {
         $parser = new self();
         return $parser->loadHtml($arguments0, $arguments1);
     }
     if ($name === 'file_get_html') {
         $parser = new self();
         return $parser->loadHtmlFile($arguments0, $arguments1);
     }
     throw new BadMethodCallException('Method does not exist');
 }