Created
November 14, 2013 03:01
-
-
Save simkimsia/7460610 to your computer and use it in GitHub Desktop.
Method for the ReplaceableBehavior.php in https://gist.github.com/simkimsia/7460467
This file contains hidden or 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
| /** | |
| * Replace all occurrences of unicorn in an array with super_duper_unicorn | |
| * | |
| * @param Model $Model | |
| * @param array $array | |
| * @return array | |
| */ | |
| public function replaceWithSuper(Model $Model, $array = array()) { | |
| foreach ($array as $key => $value) { | |
| if (is_string($value) && $value == 'unicorn') { | |
| $array[$key] = 'super_duper_unicorn'; | |
| } | |
| } | |
| return $array; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment