Skip to content
This repository was archived by the owner on Apr 26, 2020. It is now read-only.

Refactor - Replace split and join with explode and implode #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions phpQuery/phpQuery/phpQueryObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -3069,7 +3069,7 @@ protected function getNodeXpath($oneNode = null, $namespace = null) {
: "{$node->tagName}[{$i}]";
$node = $node->parentNode;
}
$xpath = join('/', array_reverse($xpath));
$xpath = implode('/', array_reverse($xpath));
$return[] = '/'.$xpath;
}
return $oneNode
Expand All @@ -3091,7 +3091,7 @@ public function whois($oneNode = null) {
.($node->getAttribute('id')
? '#'.$node->getAttribute('id'):'')
.($node->getAttribute('class')
? '.'.join('.', split(' ', $node->getAttribute('class'))):'')
? '.'.implode('.', explode(' ', $node->getAttribute('class'))):'')
.($node->getAttribute('name')
? '[name="'.$node->getAttribute('name').'"]':'')
.($node->getAttribute('value') && strpos($node->getAttribute('value'), '<'.'?php') === false
Expand Down
2 changes: 1 addition & 1 deletion phpQuery/phpQuery/plugins/WebBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ function resolve_url($base, $url) {
$path[] = $end;
}
// Step 6h
$base['path'] = join('/', $path);
$base['path'] = implode('/', $path);

}
// Step 7
Expand Down
2 changes: 1 addition & 1 deletion test-cases/xpath.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function whois($nodeList) {
.($node->getAttribute('id')
? '#'.$node->getAttribute('id'):'')
.($node->getAttribute('class')
? '.'.join('.', split(' ', $node->getAttribute('class'))):'')
? '.'.implode('.', explode(' ', $node->getAttribute('class'))):'')
);
}
print "<pre>";
Expand Down