Skip to content

Commit

Permalink
added walk recursive to query bags
Browse files Browse the repository at this point in the history
  • Loading branch information
JunkyPic committed Dec 20, 2018
1 parent 41fdfd1 commit c0364cd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Scheme/Schemes/Http/Bags/HttpImmutableQuery.php
Expand Up @@ -97,6 +97,17 @@ public function last(): ?string
return $this->lastInPath($this->query);
}

/**
* @return \Generator
*/
public function walkRecursive(): \Generator
{
foreach (new \RecursiveIteratorIterator(new \RecursiveArrayIterator($this->query)) as $key => $value) {
yield $key => $value;
}
}


/////////////////////////////////
/// INTERFACE IMPLEMENTATION ///
////////////////////////////////
Expand Down
10 changes: 10 additions & 0 deletions src/Scheme/Schemes/Https/Bags/HttpsImmutableQuery.php
Expand Up @@ -94,6 +94,16 @@ public function last()
return $this->lastInQuery($this->query);
}

/**
* @return \Generator
*/
public function walkRecursive(): \Generator
{
foreach (new \RecursiveIteratorIterator(new \RecursiveArrayIterator($this->query)) as $key => $value) {
yield $key => $value;
}
}

/////////////////////////////////
/// INTERFACE IMPLEMENTATION ///
////////////////////////////////
Expand Down

0 comments on commit c0364cd

Please sign in to comment.