@@ -90,5 +90,5 @@ |
||
| 90 | 90 | * @ingroup querypath_extensions |
| 91 | 91 | */ |
| 92 | 92 | interface Extension { |
| 93 | - public function __construct(\QueryPath\Query $qp); |
|
| 93 | + public function __construct(\QueryPath\Query $qp); |
|
| 94 | 94 | } |
@@ -10,29 +10,29 @@ |
||
| 10 | 10 | * An object capable of walking (and searching) a datastructure. |
| 11 | 11 | */ |
| 12 | 12 | interface Traverser { |
| 13 | - /** |
|
| 14 | - * Process a CSS selector and find matches. |
|
| 15 | - * |
|
| 16 | - * This specifies a query to be run by the Traverser. A given |
|
| 17 | - * Traverser may, in practice, delay the finding until some later time |
|
| 18 | - * but must return the found results when getMatches() is called. |
|
| 19 | - * |
|
| 20 | - * @param string $selector |
|
| 21 | - * A selector. Typically this is a CSS 3 Selector. |
|
| 22 | - * @return \Traverser |
|
| 23 | - * The Traverser that can return matches. |
|
| 24 | - */ |
|
| 25 | - public function find($selector); |
|
| 26 | - /** |
|
| 27 | - * Get the results of a find() operation. |
|
| 28 | - * |
|
| 29 | - * Return an array of matching items. |
|
| 30 | - * |
|
| 31 | - * @return array |
|
| 32 | - * An array of matched values. The specific data type in the matches |
|
| 33 | - * will differ depending on the data type searched, but in the core |
|
| 34 | - * QueryPath implementation, this will be an array of DOMNode |
|
| 35 | - * objects. |
|
| 36 | - */ |
|
| 37 | - public function matches(); |
|
| 13 | + /** |
|
| 14 | + * Process a CSS selector and find matches. |
|
| 15 | + * |
|
| 16 | + * This specifies a query to be run by the Traverser. A given |
|
| 17 | + * Traverser may, in practice, delay the finding until some later time |
|
| 18 | + * but must return the found results when getMatches() is called. |
|
| 19 | + * |
|
| 20 | + * @param string $selector |
|
| 21 | + * A selector. Typically this is a CSS 3 Selector. |
|
| 22 | + * @return \Traverser |
|
| 23 | + * The Traverser that can return matches. |
|
| 24 | + */ |
|
| 25 | + public function find($selector); |
|
| 26 | + /** |
|
| 27 | + * Get the results of a find() operation. |
|
| 28 | + * |
|
| 29 | + * Return an array of matching items. |
|
| 30 | + * |
|
| 31 | + * @return array |
|
| 32 | + * An array of matched values. The specific data type in the matches |
|
| 33 | + * will differ depending on the data type searched, but in the core |
|
| 34 | + * QueryPath implementation, this will be an array of DOMNode |
|
| 35 | + * objects. |
|
| 36 | + */ |
|
| 37 | + public function matches(); |
|
| 38 | 38 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | - $this->matches = $found;//UniqueElementList::get($found); |
|
| 303 | + $this->matches = $found; //UniqueElementList::get($found); |
|
| 304 | 304 | $this->findAnyElement = false; |
| 305 | 305 | } |
| 306 | 306 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - $this->matches = $found;//UniqueElementList::get($found); |
|
| 321 | + $this->matches = $found; //UniqueElementList::get($found); |
|
| 322 | 322 | $this->findAnyElement = false; |
| 323 | 323 | } |
| 324 | 324 | |
@@ -1272,7 +1272,7 @@ discard block |
||
| 1272 | 1272 | $line = trim($lines[0]); |
| 1273 | 1273 | if (!empty($line)) { |
| 1274 | 1274 | $o->textContent = $line; |
| 1275 | - $found->attach($o);//trim($lines[0]); |
|
| 1275 | + $found->attach($o); //trim($lines[0]); |
|
| 1276 | 1276 | } |
| 1277 | 1277 | } |
| 1278 | 1278 | } |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | $element->appendChild($cdata); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - return $this->qp;; |
|
| 71 | + return $this->qp; ; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Look for CDATA sections. |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | // autoloader is used. |
| 30 | 30 | if (!class_exists(QueryPath::class)) { |
| 31 | 31 | |
| 32 | - // If classloaders are explicitly disabled, load everything. |
|
| 33 | - if (defined('QP_NO_AUTOLOADER')) { |
|
| 32 | + // If classloaders are explicitly disabled, load everything. |
|
| 33 | + if (defined('QP_NO_AUTOLOADER')) { |
|
| 34 | 34 | // This is all (and only) the required classes for QueryPath. |
| 35 | 35 | // Extensions are not loaded automatically. |
| 36 | 36 | require __DIR__ . '/QueryPath/Exception.php'; |
@@ -59,24 +59,24 @@ discard block |
||
| 59 | 59 | require __DIR__ . '/QueryPath/QueryPathIterator.php'; |
| 60 | 60 | require __DIR__ . '/QueryPath/DOMQuery.php'; |
| 61 | 61 | require __DIR__ . '/QueryPath.php'; |
| 62 | - } |
|
| 63 | - else { |
|
| 62 | + } |
|
| 63 | + else { |
|
| 64 | 64 | spl_autoload_register(function ($klass) { |
| 65 | - $parts = explode('\\', $klass); |
|
| 65 | + $parts = explode('\\', $klass); |
|
| 66 | 66 | |
| 67 | - // Issue #164 |
|
| 68 | - if ($parts[0] == '') { |
|
| 67 | + // Issue #164 |
|
| 68 | + if ($parts[0] == '') { |
|
| 69 | 69 | array_shift($parts); |
| 70 | - } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - if ($parts[0] == 'QueryPath') { |
|
| 72 | + if ($parts[0] == 'QueryPath') { |
|
| 73 | 73 | $path = __DIR__ . '/' . implode('/', $parts) . '.php'; |
| 74 | 74 | if (file_exists($path)) { |
| 75 | - require $path; |
|
| 75 | + require $path; |
|
| 76 | + } |
|
| 76 | 77 | } |
| 77 | - } |
|
| 78 | 78 | }); |
| 79 | - } |
|
| 79 | + } |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // Define qp() and qphtml() function. |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | require __DIR__ . '/QueryPath.php'; |
| 62 | 62 | } |
| 63 | 63 | else { |
| 64 | - spl_autoload_register(function ($klass) { |
|
| 64 | + spl_autoload_register(function($klass) { |
|
| 65 | 65 | $parts = explode('\\', $klass); |
| 66 | 66 | |
| 67 | 67 | // Issue #164 |
@@ -59,8 +59,7 @@ |
||
| 59 | 59 | require __DIR__ . '/QueryPath/QueryPathIterator.php'; |
| 60 | 60 | require __DIR__ . '/QueryPath/DOMQuery.php'; |
| 61 | 61 | require __DIR__ . '/QueryPath.php'; |
| 62 | - } |
|
| 63 | - else { |
|
| 62 | + } else { |
|
| 64 | 63 | spl_autoload_register(function ($klass) { |
| 65 | 64 | $parts = explode('\\', $klass); |
| 66 | 65 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | function htmlqp($document = NULL, $selector = NULL, $options = array()) { |
| 183 | 183 | |
| 184 | - return QueryPath::withHTML($document, $selector, $options); |
|
| 184 | + return QueryPath::withHTML($document, $selector, $options); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -214,5 +214,5 @@ discard block |
||
| 214 | 214 | * @return \QueryPath\DOMQuery |
| 215 | 215 | */ |
| 216 | 216 | function html5qp($document = NULL, $selector = NULL, $options = array()) { |
| 217 | - return QueryPath::withHTML5($document, $selector, $options); |
|
| 217 | + return QueryPath::withHTML5($document, $selector, $options); |
|
| 218 | 218 | } |
@@ -693,7 +693,7 @@ |
||
| 693 | 693 | $winner = array_merge($winner, $local_ele); |
| 694 | 694 | } |
| 695 | 695 | } |
| 696 | - $this->setMatches($winner);//array($winner); |
|
| 696 | + $this->setMatches($winner); //array($winner); |
|
| 697 | 697 | |
| 698 | 698 | return $this; |
| 699 | 699 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require '../src/qp.php'; |
| 3 | -$xml =<<<EOF |
|
| 3 | +$xml = <<<EOF |
|
| 4 | 4 | <?xml version="1.0"?> |
| 5 | 5 | <table> |
| 6 | 6 | <tr id="row1"> |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | * manipulations on it, we could wrap it in a `qp()`. |
| 31 | 31 | */ |
| 32 | 32 | function exampleCallback($index, $item) { |
| 33 | - $text = qp($item)->text(); |
|
| 34 | - return strpos($text, 'Release') !== FALSE; |
|
| 33 | + $text = qp($item)->text(); |
|
| 34 | + return strpos($text, 'Release') !== FALSE; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /* |
@@ -45,6 +45,6 @@ discard block |
||
| 45 | 45 | * into a stand-alone function. |
| 46 | 46 | */ |
| 47 | 47 | print htmlqp('http://php.net/', 'h1.summary a') |
| 48 | - ->filterCallback('exampleCallback') |
|
| 49 | - ->textImplode(PHP_EOL); |
|
| 48 | + ->filterCallback('exampleCallback') |
|
| 49 | + ->textImplode(PHP_EOL); |
|
| 50 | 50 | ?> |
| 51 | 51 | \ No newline at end of file |