find() public method

Given a CSS Selector, find matching items.
See also: filter()
See also: is()
public find ( string $selector )
$selector string CSS 3 Selector
 /**
  * Write the title in the title tag of the page.
  */
 protected function renderTitle()
 {
     // Render page title
     if ($this->pageTitle != null) {
         $title = mb_convert_encoding($this->pageTitle, $this->getCharset(), 'auto');
         $this->qp->find("title")->append($title);
     }
 }
 /**
  * Write the title in the title tag of the page.
  */
 protected function renderTitle()
 {
     // Render page title
     if ($this->pageTitle != null) {
         $title = mb_convert_encoding($this->pageTitle, $this->getCharset(), 'auto');
         $domQuery = $this->qp->find("title");
         if ($domQuery->count() <= 0) {
             trigger_error('title tag not found in page', E_USER_WARNING);
         } else {
             $domQuery->append($title);
         }
     }
 }
 /**
  * Extract value
  *
  * @param \QueryPath\DOMQuery $item
  * @param array $mapping
  * @param string $value
  * @return string|array
  */
 public function extractValue(\QueryPath\DOMQuery $item, array $mapping, $value = '')
 {
     if (empty($mapping['multiple'])) {
         /** @var \QueryPath\DOMQuery $tmp */
         $tmp = $item->find($mapping['selector'])->first();
         $return = $this->_extractValue($tmp, $mapping, $value);
     } elseif (is_array($mapping['multiple'])) {
         $return = array();
         foreach ($item->find($mapping['selector']) as $tmp) {
             $value = array();
             foreach ($mapping['multiple'] as $key => $subMapping) {
                 $value[$key] = $this->_extractValue($tmp, is_string($subMapping) ? array('attr' => $subMapping) : $subMapping, is_string($subMapping) ? $subMapping : '');
             }
             $return[] = $value;
         }
     } else {
         $return = array();
         foreach ($item->find($mapping['selector']) as $tmp) {
             $return[] = $this->_extractValue($tmp, $mapping, $value);
         }
     }
     return $return;
 }
 /**
  *
  * @param DOMQuery $showtimesDomList
  * @param DOMQuery $movieDom
  * @return array
  */
 private function extractTimes($showtimesDomList, $movieDom)
 {
     $index = 0;
     $times = array();
     foreach ($showtimesDomList as $showtimesDom) {
         $getTicketsLink = $showtimesDom->find('a')->first();
         $showtimeTypeDom = new DOMQuery($movieDom->find('h5.li_group')->get($index++));
         $showtimeType = $showtimeTypeDom ? $this->getShowtimeType(trim($showtimeTypeDom->text(), ' :\\r\\n')) : 'digital';
         if ($getTicketsLink->length > 0) {
             $timeList = explode('|', $getTicketsLink->attr('data-times'));
             $link = $getTicketsLink->attr('href');
             foreach ($timeList as $movieTime) {
                 $times[] = array('show_date' => $this->currentDate, 'show_time' => $movieTime, 'url' => $link ? "{$link}+{$movieTime}" : '', 'type' => $showtimeType);
             }
         } else {
             $showtimes = trim(preg_replace('/\\s+/', ' ', $showtimesDom->text()));
             $showtimesArr = preg_split('/(\\|\\s*)+/', $showtimes);
             $lastAp = 'am';
             foreach ($showtimesArr as $timeThing) {
                 if (preg_match('/(am)|(pm)/i', $timeThing)) {
                     $tmp = explode(' ', $timeThing);
                     $lastAp = $tmp[1] ?: $lastAp;
                     $timeThing = $tmp[0];
                 }
                 $times[] = array('show_date' => $this->currentDate, 'show_time' => date('H:i:s', strtotime("{$timeThing} {$lastAp}")), 'type' => $showtimeType, 'url' => '');
             }
         }
     }
     return $times;
 }
 /**
  *
  * @param DOMQuery $movieDom
  * @return array
  */
 private function extractTimes($movieDom, $showtimeType)
 {
     $times = array();
     $showtimesDomList = $movieDom->find(".times > span");
     $lastAp = "";
     $replacePattern = ['/\\&[A-Za-z]+;?/', "/[^a-z0-9:]/"];
     for ($i = $showtimesDomList->length - 1; $i >= 0; $i--) {
         $stDom = new DOMQuery($showtimesDomList->get($i));
         $showtime = array();
         $timeSpan = preg_replace($replacePattern, "", trim($stDom->find("span")->first()->text()));
         $matches = array();
         if (preg_match("/(am)|(pm)/i", $timeSpan, $matches)) {
             $lastAp = $matches[0];
             $timeSpan = preg_replace("/(am)|(pm)/i", "", $timeSpan);
         }
         $actualTime = date('H:i:s', strtotime("{$timeSpan}{$lastAp}"));
         $showtime['show_date'] = $this->currentDate;
         $showtime['show_time'] = $actualTime;
         $showtime['type'] = $showtimeType;
         $ticketUrl = $stDom->find("a");
         if ($ticketUrl->length > 0) {
             $showtime['url'] = $this->extractUrl($ticketUrl->first()->attr('href'));
         } else {
             $showtime['url'] = "";
         }
         $times[] = $showtime;
     }
     return $times;
 }