Last active
August 29, 2015 14:00
-
-
Save clemherreman/11259435 to your computer and use it in GitHub Desktop.
WTF collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Collection | |
{ | |
/** | |
* Gets an item from the collection | |
* | |
* @param $item | |
* @return string|null | |
*/ | |
public function get($item) | |
{ | |
if ($key = array_search($item, $this->toArray())) { | |
return parent::offsetGet($key); | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment