QL\QueryList::_getList PHP Method

_getList() private method

private _getList ( )
    private function _getList()
    {
        $this->inputEncoding && (phpQuery::$defaultCharset = $this->inputEncoding);
        $document = phpQuery::newDocumentHTML($this->html);
        $this->qpHtml = $document->htmlOuter();
        if (!empty($this->regRange)) {
            $robj = pq($document)->find($this->regRange);
            $i = 0;
            foreach ($robj as $item) {
                while (list($key, $reg_value) = each($this->regArr)) {
                    if ($key == 'callback') {
                        continue;
                    }
                    $tags = isset($reg_value[2]) ? $reg_value[2] : '';
                    $iobj = pq($item)->find($reg_value[0]);
                    switch ($reg_value[1]) {
                        case 'text':
                            $this->data[$i][$key] = $this->_allowTags(pq($iobj)->html(), $tags);
                            break;
                        case 'html':
                            $this->data[$i][$key] = $this->_stripTags(pq($iobj)->html(), $tags);
                            break;
                        default:
                            $this->data[$i][$key] = pq($iobj)->attr($reg_value[1]);
                            break;
                    }
                    if (isset($reg_value[3])) {
                        $this->data[$i][$key] = call_user_func($reg_value[3], $this->data[$i][$key], $key);
                    } else {
                        if (isset($this->regArr['callback'])) {
                            $this->data[$i][$key] = call_user_func($this->regArr['callback'], $this->data[$i][$key], $key);
                        }
                    }
                }
                //重置数组指针
                reset($this->regArr);
                $i++;
            }
        } else {
            while (list($key, $reg_value) = each($this->regArr)) {
                if ($key == 'callback') {
                    continue;
                }
                $document = phpQuery::newDocumentHTML($this->html);
                $tags = isset($reg_value[2]) ? $reg_value[2] : '';
                $lobj = pq($document)->find($reg_value[0]);
                $i = 0;
                foreach ($lobj as $item) {
                    switch ($reg_value[1]) {
                        case 'text':
                            $this->data[$i][$key] = $this->_allowTags(pq($item)->html(), $tags);
                            break;
                        case 'html':
                            $this->data[$i][$key] = $this->_stripTags(pq($item)->html(), $tags);
                            break;
                        default:
                            $this->data[$i][$key] = pq($item)->attr($reg_value[1]);
                            break;
                    }
                    if (isset($reg_value[3])) {
                        $this->data[$i][$key] = call_user_func($reg_value[3], $this->data[$i][$key], $key);
                    } else {
                        if (isset($this->regArr['callback'])) {
                            $this->data[$i][$key] = call_user_func($this->regArr['callback'], $this->data[$i][$key], $key);
                        }
                    }
                    $i++;
                }
            }
        }
        if ($this->outputEncoding) {
            //编码转换
            $this->data = $this->_arrayConvertEncoding($this->data, $this->outputEncoding, $this->htmlEncoding);
        }
        phpQuery::$documents = array();
    }