Passed
Push — master ( 28bf1e...61fea9 )
by Arthur
02:09
created
src/Extension.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,5 +90,5 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/CSS/Traverser.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -10,29 +10,29 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/CSS/QueryPathEventHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
src/Extension/QPXML.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
examples/at_a_glance.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
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">
Please login to merge, or discard this patch.
examples/matching_text_content.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
examples/dbpedia.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
 //$url = 'http://dbpedia.org/data/The_Lord_of_the_Rings.rdf';
34 34
 // HTTP headers:
35 35
 $headers = array(
36
-  'Accept: application/rdf,application/rdf+xml;q=0.9,*/*;q=0.8',
37
-  'Accept-Language: en-us,en',
38
-  'Accept-Charset: ISO-8859-1,utf-8',
39
-  'User-Agent: QueryPath/1.2',
36
+    'Accept: application/rdf,application/rdf+xml;q=0.9,*/*;q=0.8',
37
+    'Accept-Language: en-us,en',
38
+    'Accept-Charset: ISO-8859-1,utf-8',
39
+    'User-Agent: QueryPath/1.2',
40 40
 );
41 41
 
42 42
 // The context options:
43 43
 $options = array(
44
-  'http' => array(
44
+    'http' => array(
45 45
     'method' => 'GET',
46 46
     'protocol_version' => 1.1,
47 47
     'header' => implode("\r\n", $headers),
48
-  ),
48
+    ),
49 49
 );
50 50
 
51 51
 // Create a stream context that will tell QueryPath how to 
@@ -78,21 +78,21 @@  discard block
 block discarded – undo
78 78
 
79 79
 print "\nImages:\n";
80 80
 foreach ($qp->branch()->find('foaf|img') as $img) {
81
-  // Note that when we use attr() we are using the XML name, NOT 
82
-  // the CSS 3 name. So it is rdf:resource, not rdf|resource.
83
-  // The same goes for the tag() function -- it will return 
84
-  // the full element name (e.g. rdf:Description).
85
-  print $img->attr('rdf:resource') . PHP_EOL;
81
+    // Note that when we use attr() we are using the XML name, NOT 
82
+    // the CSS 3 name. So it is rdf:resource, not rdf|resource.
83
+    // The same goes for the tag() function -- it will return 
84
+    // the full element name (e.g. rdf:Description).
85
+    print $img->attr('rdf:resource') . PHP_EOL;
86 86
 }
87 87
 
88 88
 print "\nImages Galleries:\n";
89 89
 foreach ($qp->branch()->find('dbpprop|hasPhotoCollection') as $img) {
90
-  print $img->attr('rdf:resource') . PHP_EOL;
90
+    print $img->attr('rdf:resource') . PHP_EOL;
91 91
 }
92 92
 
93 93
 print "\nOther Sites:\n";
94 94
 foreach ($qp->branch()->find('foaf|page') as $img) {
95
-  print $img->attr('rdf:resource') . PHP_EOL;
95
+    print $img->attr('rdf:resource') . PHP_EOL;
96 96
 }
97 97
 
98 98
 //$qp->writeXML();
99 99
\ No newline at end of file
Please login to merge, or discard this patch.
examples/rss.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 // simplicity, we are just using a nested array. Of
52 52
 // course, this could be a database lookup or whatever.
53 53
 $items = array(
54
-  array(
54
+    array(
55 55
     'title' => 'Item 1',
56 56
     'link' => 'http://example.com/item1',
57 57
     'description' => '<strong>This has embedded <em>HTML</em></strong>',
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
     'category' => 'Some Term',
60 60
     'pubDate' => date('r'),
61 61
     'guid' => '123456-789',
62
-  ),
63
-  array(
62
+    ),
63
+    array(
64 64
     'title' => 'Item 2',
65 65
     'link' => 'http://example.com/item2',
66 66
     'description' => '<strong>This has embedded <em>HTML</em></strong>',
@@ -68,22 +68,22 @@  discard block
 block discarded – undo
68 68
     'category' => 'Some Other Term',
69 69
     'pubDate' => date('r'),
70 70
     'guid' => '123456-790',
71
-  ),
71
+    ),
72 72
 );
73 73
 
74 74
 // The main QueryPath, which holds the channel.
75 75
 $qp = qp($rss_stub, 'title')
76
-  ->text('A QueryPath RSS Feed')
77
-  ->next('link')->text('http://example.com')
78
-  ->next('description')->text('QueryPath: Find your way.')
79
-  ->parent();
76
+    ->text('A QueryPath RSS Feed')
77
+    ->next('link')->text('http://example.com')
78
+    ->next('description')->text('QueryPath: Find your way.')
79
+    ->parent();
80 80
 
81 81
 // For each element in the array above, we create a new 
82 82
 // QueryPath and then populate the XML fragment with data.
83 83
 foreach ($items as $item) {
84 84
   
85
-  // Begin with the stub RSS item, with title currently selected.
86
-  $qpi = qp($rss_item_stub, 'title')
85
+    // Begin with the stub RSS item, with title currently selected.
86
+    $qpi = qp($rss_item_stub, 'title')
87 87
     // Add a title.
88 88
     ->text($item['title']) 
89 89
     // Add a link. Note that we are giving no args to next() for the
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
     ->next()->text($item['pubDate'])
99 99
     ->next()->text($item['guid']);
100 100
     
101
-  // Now we append it.
102
-  $qp->append($qpi->top());
101
+    // Now we append it.
102
+    $qp->append($qpi->top());
103 103
 }
104 104
 
105 105
 // If we were running this on a server, we would need to set the content
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 require_once '../src/QueryPath/QueryPath.php';
22 22
 
23 23
 // This is the stub RSS document.
24
-$rss_stub ='<?xml version="1.0"?>
24
+$rss_stub = '<?xml version="1.0"?>
25 25
 <rss version="2.0" 
26 26
   xmlns:dc="http://purl.org/dc/elements/1.1/">
27 27
   <channel>
Please login to merge, or discard this patch.
examples/techniques.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 
36 36
 // Iterate over elements as DOMNodes:
37 37
 foreach ($qp->get() as $li_ele) {
38
-  print $li_ele->tagName . PHP_EOL; // Prints 'li' five times.
38
+    print $li_ele->tagName . PHP_EOL; // Prints 'li' five times.
39 39
 }
40 40
 
41 41
 // Iterate over elements as QueryPath objects
42 42
 foreach ($qp as $li_qp) {
43
-  print $li_qp->tag() . PHP_EOL; // Prints 'li' five times
43
+    print $li_qp->tag() . PHP_EOL; // Prints 'li' five times
44 44
 }
45 45
 
46 46
 function callbackFunction($index, $element) {
47
-  print $element->tagName . PHP_EOL;
47
+    print $element->tagName . PHP_EOL;
48 48
 }
49 49
 
50 50
 // Iterate using a callback function
@@ -55,6 +55,6 @@  discard block
 block discarded – undo
55 55
 
56 56
 // Loop through by index/count
57 57
 for ($i = 0; $i < $qp->size(); ++$i) {
58
-  $domElement = $qp->get($i);
59
-  print $domElement->tagName . PHP_EOL;
58
+    $domElement = $qp->get($i);
59
+    print $domElement->tagName . PHP_EOL;
60 60
 }
61 61
\ No newline at end of file
Please login to merge, or discard this patch.