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

Commit

Permalink
Merge branch 'dom-renamed-interfaces' of https://github.com/prolic/zf2
Browse files Browse the repository at this point in the history
…into feature/zen27-dom
  • Loading branch information
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/Exception.php → src/Exception/ExceptionInterface.php
Expand Up @@ -18,7 +18,7 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Dom;
namespace Zend\Dom\Exception;

/**
* Zend_Dom Exceptions
Expand All @@ -28,6 +28,6 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Exception
interface ExceptionInterface
{
}
5 changes: 3 additions & 2 deletions src/Exception/RuntimeException.php
Expand Up @@ -23,12 +23,13 @@
/**
* Zend_Dom Exceptions
*
* @uses \Zend\Dom\Exception
* @category Zend
* @package Zend_Dom
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class RuntimeException extends \RuntimeException implements \Zend\Dom\Exception
class RuntimeException
extends \RuntimeException
implements ExceptionInterface
{
}
13 changes: 9 additions & 4 deletions src/NodeList.php
Expand Up @@ -20,17 +20,22 @@

namespace Zend\Dom;

use Iterator,
Countable,
DOMDocument,
DOMNodeList,
DOMXPath,
DOMElement;

/**
* Nodelist for DOM XPath query
*
* @uses Iterator
* @uses Countable
* @package Zend_Dom
* @subpackage Query
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class NodeList implements \Iterator,\Countable
class NodeList implements Iterator, Countable
{
/**
* Number of results
Expand Down Expand Up @@ -80,7 +85,7 @@ class NodeList implements \Iterator,\Countable
* @param DOMNodeList $nodeList
* @return void
*/
public function __construct($cssQuery, $xpathQuery, \DOMDocument $document, \DOMNodeList $nodeList)
public function __construct($cssQuery, $xpathQuery, DOMDocument $document, DOMNodeList $nodeList)
{
$this->_cssQuery = $cssQuery;
$this->_xpathQuery = $xpathQuery;
Expand Down
18 changes: 10 additions & 8 deletions src/Query.php
Expand Up @@ -20,12 +20,13 @@

namespace Zend\Dom;

use DOMDocument,
DOMNodeList,
DOMXPath;

/**
* Query DOM structures based on CSS selectors and/or XPath
*
* @uses Zend\Dom\Exception
* @uses Zend\Dom\Css2Xpath
* @uses Zend\Dom\NodeList
* @package Zend_Dom
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
Expand Down Expand Up @@ -210,7 +211,7 @@ public function getDocumentErrors()
* Perform a CSS selector query
*
* @param string $query
* @return \Zend\Dom\NodeList
* @return NodeList
*/
public function execute($query)
{
Expand All @@ -223,7 +224,8 @@ public function execute($query)
*
* @param string|array $xpathQuery
* @param string|null $query CSS selector query
* @return \Zend\Dom\NodeList
* @throws Exception\RuntimeException
* @return NodeList
*/
public function queryXpath($xpathQuery, $query = null)
{
Expand All @@ -234,9 +236,9 @@ public function queryXpath($xpathQuery, $query = null)
$encoding = $this->getEncoding();
libxml_use_internal_errors(true);
if (null === $encoding) {
$domDoc = new \DOMDocument('1.0');
$domDoc = new DOMDocument('1.0');
} else {
$domDoc = new \DOMDocument('1.0', $encoding);
$domDoc = new DOMDocument('1.0', $encoding);
}

$type = $this->getDocumentType();
Expand Down Expand Up @@ -285,7 +287,7 @@ public function registerXpathNamespaces($xpathNamespaces)
*/
protected function _getNodeList($document, $xpathQuery)
{
$xpath = new \DOMXPath($document);
$xpath = new DOMXPath($document);
foreach ($this->_xpathNamespaces as $prefix => $namespaceUri) {
$xpath->registerNamespace($prefix, $namespaceUri);
}
Expand Down
2 changes: 1 addition & 1 deletion test/QueryTest.php
Expand Up @@ -22,7 +22,7 @@
namespace ZendTest\Dom;
use Zend\Dom\Query,
Zend\Dom\NodeList,
Zend\Dom\Exception as DOMException;
Zend\Dom\Exception\ExceptionInterface as DOMException;

/**
* Test class for Zend_Dom_Query.
Expand Down

0 comments on commit be3c33f

Please sign in to comment.