Created
July 20, 2012 10:07
-
-
Save Alan01252/3149984 to your computer and use it in GitHub Desktop.
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 | |
public function getContactByKey($key) { | |
$collection = null; | |
if($this->getContact()){ | |
$collection = $this->getContact()->filter(function($element) use($key) {return ($element->getKey() === $key) ? $element : null;}); | |
if($collection->current()) | |
return $collection->current()->getValue(); | |
} | |
return null; | |
} | |
public function getContactByKey($key) { | |
$collection = null; | |
if($this->getContact()){ | |
foreach($this->getContact() as $contact) { | |
if($contact->getKey() === $key) | |
return $contact->getValue(); | |
} | |
} | |
return null; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment