Skip to content

Commit 37dccaf

Browse files
committed
Improve test coverage for Parser
1 parent 8fcb8e5 commit 37dccaf

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/Io/Parser.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,7 @@ public function parseLogRevisions(SimpleXMLElement $xml)
4141
}
4242

4343
// href contains r1 and r2 as query parameters
44-
$href = (string)$anchor['href'];
45-
$pos = strpos($href, '?');
46-
if ($pos === false) {
47-
continue;
48-
}
49-
50-
$args = array();
51-
parse_str(substr($href, $pos + 1), $args);
44+
$args = $this->linkParameters((string)$anchor['href']);
5245

5346
// all links containing r2 are links to previous revision
5447
if (isset($args['r2'])) {
@@ -58,4 +51,16 @@ public function parseLogRevisions(SimpleXMLElement $xml)
5851

5952
return $revisions;
6053
}
54+
55+
private function linkParameters($href)
56+
{
57+
$args = array();
58+
$pos = strpos($href, '?');
59+
60+
if ($pos !== false) {
61+
parse_str(substr($href, $pos + 1), $args);
62+
}
63+
64+
return $args;
65+
}
6166
}

0 commit comments

Comments
 (0)