Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
[#1791] Updated for CS
Browse files Browse the repository at this point in the history
- Removed underscore prefix from all protected members
- Docblocks changed to do namespace/import resolution of classes
  • Loading branch information
weierophinney committed Jul 11, 2012
1 parent c6edc69 commit 9507fa4
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions library/Zend/Dom/Query.php
Expand Up @@ -32,37 +32,37 @@ class Query
/**
* @var string
*/
protected $_document;
protected $document;

/**
* DOMDocument errors, if any
* @var false|array
*/
protected $_documentErrors = false;
protected $documentErrors = false;

/**
* Document type
* @var string
*/
protected $_docType;
protected $docType;

/**
* Document encoding
* @var null|string
*/
protected $_encoding;
protected $encoding;

/**
* XPath namespaces
* @var array
*/
protected $_xpathNamespaces = array();
protected $xpathNamespaces = array();

/**
* XPath PHP Functions
* @var mixed
*/
protected $_xpathPhpFunctions;
protected $xpathPhpFunctions;

/**
* Constructor
Expand All @@ -80,11 +80,11 @@ public function __construct($document = null, $encoding = null)
* Set document encoding
*
* @param string $encoding
* @return \Zend\Dom\Query
* @return Query
*/
public function setEncoding($encoding)
{
$this->_encoding = (null === $encoding) ? null : (string) $encoding;
$this->encoding = (null === $encoding) ? null : (string) $encoding;
return $this;
}

Expand All @@ -95,15 +95,15 @@ public function setEncoding($encoding)
*/
public function getEncoding()
{
return $this->_encoding;
return $this->encoding;
}

/**
* Set document to query
*
* @param string $document
* @param null|string $encoding Document encoding
* @return \Zend\Dom\Query
* @return Query
*/
public function setDocument($document, $encoding = null)
{
Expand All @@ -113,7 +113,7 @@ public function setDocument($document, $encoding = null)
// breaking XML declaration to make syntax highlighting work
if ('<' . '?xml' == substr(trim($document), 0, 5)) {
if (preg_match('/<html[^>]*xmlns="([^"]+)"[^>]*>/i', $document, $matches)) {
$this->_xpathNamespaces[] = $matches[1];
$this->xpathNamespaces[] = $matches[1];
return $this->setDocumentXhtml($document, $encoding);
}
return $this->setDocumentXml($document, $encoding);
Expand All @@ -129,12 +129,12 @@ public function setDocument($document, $encoding = null)
*
* @param string $document
* @param null|string $encoding Document encoding
* @return \Zend\Dom\Query
* @return Query
*/
public function setDocumentHtml($document, $encoding = null)
{
$this->_document = (string) $document;
$this->_docType = self::DOC_HTML;
$this->document = (string) $document;
$this->docType = self::DOC_HTML;
if (null !== $encoding) {
$this->setEncoding($encoding);
}
Expand All @@ -146,12 +146,12 @@ public function setDocumentHtml($document, $encoding = null)
*
* @param string $document
* @param null|string $encoding Document encoding
* @return \Zend\Dom\Query
* @return Query
*/
public function setDocumentXhtml($document, $encoding = null)
{
$this->_document = (string) $document;
$this->_docType = self::DOC_XHTML;
$this->document = (string) $document;
$this->docType = self::DOC_XHTML;
if (null !== $encoding) {
$this->setEncoding($encoding);
}
Expand All @@ -163,12 +163,12 @@ public function setDocumentXhtml($document, $encoding = null)
*
* @param string $document
* @param null|string $encoding Document encoding
* @return \Zend\Dom\Query
* @return Query
*/
public function setDocumentXml($document, $encoding = null)
{
$this->_document = (string) $document;
$this->_docType = self::DOC_XML;
$this->document = (string) $document;
$this->docType = self::DOC_XML;
if (null !== $encoding) {
$this->setEncoding($encoding);
}
Expand All @@ -182,7 +182,7 @@ public function setDocumentXml($document, $encoding = null)
*/
public function getDocument()
{
return $this->_document;
return $this->document;
}

/**
Expand All @@ -192,7 +192,7 @@ public function getDocument()
*/
public function getDocumentType()
{
return $this->_docType;
return $this->docType;
}

/**
Expand All @@ -202,7 +202,7 @@ public function getDocumentType()
*/
public function getDocumentErrors()
{
return $this->_documentErrors;
return $this->documentErrors;
}

/**
Expand Down Expand Up @@ -252,7 +252,7 @@ public function queryXpath($xpathQuery, $query = null)
}
$errors = libxml_get_errors();
if (!empty($errors)) {
$this->_documentErrors = $errors;
$this->documentErrors = $errors;
libxml_clear_errors();
}
libxml_use_internal_errors(false);
Expand All @@ -261,30 +261,30 @@ public function queryXpath($xpathQuery, $query = null)
throw new Exception\RuntimeException(sprintf('Error parsing document (type == %s)', $type));
}

$nodeList = $this->_getNodeList($domDoc, $xpathQuery);
$nodeList = $this->getNodeList($domDoc, $xpathQuery);
return new NodeList($query, $xpathQuery, $domDoc, $nodeList);
}

/**
* Register XPath namespaces
*
* @param array $xpathNamespaces
* @return void
* @param array $xpathNamespaces
* @return void
*/
public function registerXpathNamespaces($xpathNamespaces)
{
$this->_xpathNamespaces = $xpathNamespaces;
$this->xpathNamespaces = $xpathNamespaces;
}

/**
* Register PHP Functions to use in internal DOMXPath
*
* @param mixed $restrict
* @param mixed $restrict
* @return void
*/
public function registerXpathPhpFunctions($xpathPhpFunctions = true)
{
$this->_xpathPhpFunctions = $xpathPhpFunctions;
$this->xpathPhpFunctions = $xpathPhpFunctions;
}

/**
Expand All @@ -294,17 +294,17 @@ public function registerXpathPhpFunctions($xpathPhpFunctions = true)
* @param string|array $xpathQuery
* @return array
*/
protected function _getNodeList($document, $xpathQuery)
protected function getNodeList($document, $xpathQuery)
{
$xpath = new DOMXPath($document);
foreach ($this->_xpathNamespaces as $prefix => $namespaceUri) {
foreach ($this->xpathNamespaces as $prefix => $namespaceUri) {
$xpath->registerNamespace($prefix, $namespaceUri);
}
if ($this->_xpathPhpFunctions) {
if ($this->xpathPhpFunctions) {
$xpath->registerNamespace("php", "http://php.net/xpath");
($this->_xpathPhpFunctions === true) ?
($this->xpathPhpFunctions === true) ?
$xpath->registerPHPFunctions()
: $xpath->registerPHPFunctions($this->_xpathPhpFunctions);
: $xpath->registerPHPFunctions($this->xpathPhpFunctions);
}
$xpathQuery = (string) $xpathQuery;
return $xpath->query($xpathQuery);
Expand Down

0 comments on commit 9507fa4

Please sign in to comment.