QueryPath::with PHP Метод

with() публичный статический Метод

public static with ( $document = null, $selector = null, $options = [] )
    public static function with($document = null, $selector = null, $options = array())
    {
        $qpClass = isset($options['QueryPath_class']) ? $options['QueryPath_class'] : '\\QueryPath\\DOMQuery';
        $qp = new $qpClass($document, $selector, $options);
        return $qp;
    }

Usage Example

Пример #1
0
 /**
  * Given an XSLT stylesheet, run a transformation.
  *
  * This will attempt to read the provided stylesheet and then
  * execute it on the current source document.
  *
  * @param mixed $style
  *  This takes a QueryPath object or <em>any</em> of the types that the
  *  {@link qp()} function can take.
  * @return QueryPath
  *  A QueryPath object wrapping the transformed document. Note that this is a
  *  <i>different</em> document than the original. As such, it has no history.
  *  You cannot call {@link QueryPath::end()} to undo a transformation. (However,
  *  the original source document will remain unchanged.)
  */
 public function xslt($style)
 {
     if (!$style instanceof QueryPath) {
         $style = \QueryPath::with($style);
     }
     $sourceDoc = $this->src->top()->get(0)->ownerDocument;
     $styleDoc = $style->get(0)->ownerDocument;
     $processor = new \XSLTProcessor();
     $processor->importStylesheet($styleDoc);
     return \QueryPath::with($processor->transformToDoc($sourceDoc));
 }
All Usage Examples Of QueryPath::with