Skip to content

Commit

Permalink
Making unwrap public, because "Coding Standards"
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed May 10, 2015
1 parent 04675ba commit d19485b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Collection/CollectionInterface.php
Expand Up @@ -855,5 +855,5 @@ public function isEmpty();
*
* @return \Iterator
*/
public function _unwrap();
public function unwrap();
}
13 changes: 12 additions & 1 deletion src/Collection/CollectionTrait.php
Expand Up @@ -544,12 +544,23 @@ public function isEmpty()
* {@inheritDoc}
*
*/
public function _unwrap()
public function unwrap()
{
$iterator = $this;
while (get_class($iterator) === 'Cake\Collection\Collection') {
$iterator = $iterator->getInnerIterator();
}
return $iterator;
}

/**
* Backwards compatible wrapper for unwrap()
*
* @return \Iterator
* @deprecated
*/
public function _unwrap()
{
return $this->unwrap();
}
}

0 comments on commit d19485b

Please sign in to comment.